0
点赞
收藏
分享

微信扫一扫

android 字体加粗


####1、英文字体加粗
1)直接在XML文件修改

android:textStyle="bold"

####2、中文字体加粗
不能直接在xml文件修改
1)一种方法

TextView textView= (TextView)findViewById(R.id.textView);  
TextPaint paint = textView.getPaint();
paint.setFakeBoldText(true);

2)另一种方法

TextView textView = (TextView)findViewById(R.id.textView);  
    textView .setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));  
   
    //设置不为加粗   //textView.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));


举报

相关推荐

0 条评论