I\'m trying to use a custom font on elements of a listview. So in my ListViewAdapter constructor I have:
private Context context;
private List
OpenSans-Regular.ttf should be under fonts folder .
folder structure should be like this :
assets-> fonts ->OpenSans-Regular.ttf
i think by mistake you have added under assets folder
I do my fonts like this: (I declare them in my MainActivity)
public static TypeFace FONT_HEADINGS;
Then I set them up in onCreate()
FONT_HEADINGS = Typeface.createFromAsset(this.getAssets(), "MyriadPro-Cond.otf");
At this point, I can reference them throughout my app as:
sampleTextView.setTypeFace(MainActivity.FONT_HEADINGS);
Edit:
"src/main/assests/fonts"
the "assets" folder should not be under the "src" folder. It belongs in the at the same level as the src, res, etc.
One problem that's overlooked (by Android Studio users) is that the "assets/" folder is NOT on the same level as "src/". It is INSIDE "src/main/"
Because I didn't see this earlier, I spent two hours last night, and an hour this morning just trying to change the font in my navigation drawer.
I believe this is the same reason why pixlUI and calligraphy libraries did not work for me.