Text with custom font and bold style

后端 未结 5 1397
春和景丽
春和景丽 2021-01-06 06:21

I am developing an application. I am using custom font. \".ttf\" file to customize font of text view. I used the code as:

Typeface tfArchitectsDaughter = Typ         


        
5条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-06 06:51

    You can use the below code to set your text as bold

    create a seperate file as style.xml

    
    
        
    
        
    
    

    And in your java file if you want the text to be bold after can action means

    Typeface tfArchitectsDaughter = Typeface.createFromAsset(getAssets(), "fonts/ArchitectsDaughter.ttf");
    textview.setTypeface(tfArchitectsDaughter);
    
    myTextView.setTextAppearance(getApplicationContext(), R.style.boldText);
    

提交回复
热议问题