Use external fonts in android

后端 未结 6 1487
被撕碎了的回忆
被撕碎了的回忆 2020-11-27 13:31

I want to use external fonts in my app. I have tried adding new fonts using AssetManager but it did not work. Below is my code:

Typ         


        
6条回答
  •  青春惊慌失措
    2020-11-27 14:06

    android supports both otf and ttf formats, i experienced both of them.

    tv3 = (TextView)findViewById(R.id.tv1);
        Typeface typeFace = Typeface.createFromAsset(getAssets(), "fonts/TRAJANPRO-BOLD.OTF");
        tv3.setTypeface(typeFace);
    

    this is the step i used for both english and local languages

提交回复
热议问题