Reputation: 1
we want to check android devices installed fonts, can we check it in android Java & can install any font there
Upvotes: 0
Views: 5475
Reputation: 190
There are only three system wide fonts in Android; normal (Droid Sans), serif (Droid Serif), and monospace (Droid Sans Mono).
Applications can install fonts for themselves, but not for system-wide use.
To package your own font, include a truetype font file (.ttf) as an asset and use the Typeface class to load it, and the setTypeface method of TextView to use it.
Upvotes: 4
Reputation: 7625
To use a special font create a normal TextView:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/custom_font"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="This is the Chantelli Antiqua font."/>
</LinearLayout>
Then set a custom Typeface from an asset (this is your desired font):
TextView txt = (TextView) findViewById(R.id.custom_font);
Typeface font = Typeface.createFromAsset(getAssets(), "Chantelli_Antiqua.ttf");
txt.setTypeface(font);
The code is from: http://mobile.tutsplus.com/tutorials/android/customize-android-fonts/
I hope I could help.
Upvotes: 1