Where should I put the “ttf” files in an Android project?

后端 未结 7 2034
眼角桃花
眼角桃花 2020-12-16 10:47

I\'m trying to use fonts in my project using Typeface. I copied the \"font.ttf\" into a folder named \"fonts\" inside \"assets\" folder. But eclipse do not allo

7条回答
  •  执念已碎
    2020-12-16 11:12

    Please check this link, it may be helpful to you.


    OR


    use below code.

    Typeface tf = Typeface.createFromAsset(this.getAssets(),"fonts/LATINWD.TTF");
    txt1.setTypeface(tf);
    

    .ttf file is in --> assets/fonts/LATINWD.TTF

    Please first clean your project then check again.

    Happy Coding.

提交回复
热议问题