How to change the Font styles and face in Android?

前端 未结 6 1501
不知归路
不知归路 2020-12-14 11:28

I want to change the font face and styles in android. How to do this? Am using emulator. Is this possible to change in emulator. Is there any permissions available to do tha

6条回答
  •  星月不相逢
    2020-12-14 12:13

    in android only five fonttype-face

    TypeFace

    Typeface.DEFAULT
    Typeface.MONOSPACE
    Typeface.SANS_SERIF
    Typeface.DEFAULT_BOLD
    Typeface.SERIF
    

    and font-type

    Typeface.NORMAL
    Typeface.BOLD
    Typeface.BOLD_ITALIC
    Typeface.ITALIC
    

    you can use like as

    textView.setTypeface(Typeface.DEFAULT, Typeface.BOLD);
    

    and other way is you can download any .ttf file and put it in asset folder and use like as this

    Typeface type=Typeface.createFromAsset(context.getAssets(),
            "DroidSansMono.ttf");
    textView.setTypeface(type, null);
    

提交回复
热议问题