- How to set custom Font face in android.
- How to change font of the TextView
- Set Font run time in android.
- How to change Font face run time in android.
- Setting Font face of TextView,EditText in android.
- Download free android tutorial for how to set Font face.
- Android setting font face run time example code.
|
This is a simple tutorial for android beginner which will help you to understand how to use custom fonts in your android app.
Android allows user to set Fonts in easier way.
But there is one limitation that you can't set font face using xml, you must need to set font face using code(run time).
You can set Font face of TextView as well as EditText run time.
Steps to set custom fonts in android.
- Create one TextView using xml.
<TextView
android:id="@+id/tv_example"
android:text="gtu mca"
android:layout_width="wrap_content"
android:layout_height="wrap_content" > - Give reference in java code
TextView tvExample = (TextVi1ew)findViewById(R.id.tv_example);
- Put Font face file in your assets folder
find from below sample code Fiance.otf
- Create and Initialize object of TypeFace from assets folder
Typeface font = Typeface.createFromAsset(getAssets(),Fiance.otf");
- Set Font face to TextView
tvExample.setTypeface(font);
- Build and run your project.
- Here you goes...
Related Links
- Get number of lines lines of TextView in Android.
- How to create simple TextView in android.
- Latest IT news updates