Set Custom Font to View Android Example

You have to put your font fonts/samplefont.ttf into assets/fonts folder in your project!

// set own custom font from assets
TextView txt = (TextView) findViewById(R.id.custom_font);
Typeface mFace = Typeface.createFromAsset(getContext().getAssets(),
                                             "fonts/samplefont.ttf");
    txt.setTypeface(mFace);
This entry was posted in Android Examples Code and tagged , . Bookmark the permalink.


Comments are closed.



3,887 views