質問

First off, I'm a total noob. I have tried to look online for a list of the available fonts in Android. I want to have the names so that I can choose a font when drawing text. This is the method I will be using to set my font:

import android.graphics.Typeface;
...
...
    Typeface font = Typeface.createFromAsset(context.getAssets(), "/*someSpecificFont.ttf*/");
...

Once I find out the names of the fonts, how would I specify the String so that a "FontNotFound" (if such an error exists, probably more like FileNotFound) is not thrown?

Thanks Chris

役に立ちましたか?

解決

There are only 3 fonts available as part of android; normal (Droid Sans), serif (Droid Serif), and monospace (Droid Sans Mono). Here is a post that can help you to find how to enumerate fonts in android:

http://www.ulduzsoft.com/2012/01/enumerating-the-fonts-on-android-platform/

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top