Hello I'm trying to use a Custom font to my Button I've added the font on res/assets.
On my .java I have this code
Button btjoc = (Button) findViewById(R.id.btJoc);
Typeface font = Typeface.createFromAsset(getAssets(), "Heart Breaking Bad.ttf");
btjoc.setTypeface(font);
Button bttaula = (Button) findViewById(R.id.btTaula);
bttaula.setTypeface(font);
And it doesn't work... I don't know if I have to put something else, wish you can help me...
Thanks.
Do you see any logcat error? Do you have related font in your assets directory? try to change your font name in asset folder and your code to Heart_Breaking_Bad.ttf
you must moved it to main/assets
instead of res/assets
.
and see my answer here , maybe help you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.