I don't want to use the default font for my app.
I want to use my desired font.
Therefore, I copied my desired font in assets/fonts/
folder and coded as shown below.
However, an error occurs.
Please help me use the same font for the full app.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
LinearLayout ll = new LinearLayout(this);
ll.setBackgroundResource(R.drawable.bg);
this.setContentView(ll);
TextView tv = (TextView) findViewById(R.id.app_name);
Typeface face = Typeface.createFromAsset(getAssets(),
"fonts/TAU_MADN.TTF");
tv.setTypeface(face);
UPDATE:
My xml TextView
code;
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="app_name"
android:textStyle="bold" />
Error:
error: Error: String types not allowed (at 'id' with value 'app_name').