how to change custom font to bold italic in java

Solutions on MaxInterview for how to change custom font to bold italic in java by the best coders in the world

showing results for - "how to change custom font to bold italic in java"
Emilio
23 Feb 2019
1public class MainActivity extends AppCompatActivity {
2
3    @Override
4    protected void onCreate(Bundle savedInstanceState) {
5        super.onCreate(savedInstanceState);
6        setContentView(R.layout.activity_main);
7
8        Typeface font = Typeface.createFromAsset(getAssets(), "fonts/bebas_neue_regular.ttf");
9
10        TextView tvNormal = (TextView) findViewById(R.id.normal);
11        tvNormal.setTypeface(font);
12
13        TextView tvBold = (TextView) findViewById(R.id.bold);
14        tvBold.setTypeface(font, Typeface.BOLD);
15
16        TextView tvItalic = (TextView) findViewById(R.id.italic);
17        tvItalic.setTypeface(font, Typeface.ITALIC);
18
19
20        TextView tvBoth = (TextView) findViewById(R.id.boldItalic);
21        tvBoth.setTypeface(font, Typeface.BOLD_ITALIC);
22    }
23}
24