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

后端 未结 7 2040
眼角桃花
眼角桃花 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 10:54

    Put your Font File in Assest Folder,

    and in use Bellow Code for access.

    Typeface tf=Typeface.createFromAsset(getAssets(),"fonts/Century Gothic.ttf");
    
    
    textview=(TextView)findViewById(R.id.textviewone);
           textview.setTypeface(tf);
    

    ttf file is in --> assets/fonts/Century Gothic.ttf

提交回复
热议问题