在xml文件中使用android:textStyle="bold" 可以将英文设置成粗体,但是不能将中文设置成粗体,将中文设置成粗体的方法是: TextView tv = (TextView)findViewById(R.id.TextView01); TextPaint tp = tv.getPaint(); tp.setFakeBoldText(true); 其他还有: textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 24f);//设置成24sp  textView.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));//可能中文加粗无效 textView.setTypeface(Typeface.defaultFromStyle(Typeface.ITALIC));//可能中文无效 textView.setText(Html.fromHtml("<u>"+texts+"</u>"));//下划线 textView.setTypeface(Typeface.MONOSPACE,Typeface.ITALIC);//斜体,中文有效 textView.getPaint().setFlags(Paint. STRIKE_THRU_TEXT_FLAG );//中间加横线 textView.getPaint().setFlags(Paint. UNDERLINE_TEXT_FLAG );//底部加横线  promotionLinkText = (TextView) this .findViewById(R.id. text_promotion_link ); 中间加横线 promotionLinkText .getPaint().setFlags(Paint. STRIKE_THRU_TEXT_FLAG ); 底部加横线: promotionLinkText .getPaint().setFlags(Paint. UNDERLINE_TEXT_FLAG );

更多相关文章

  1. android中将中文以粗体显示
  2. Android2.2 API 中文文档系列(2) —— EditText
  3. Android(安卓)APK瘦身之Android(安卓)Studio Lint (代码审查)
  4. android api 中文 (75)—— AdapterView.OnItemClickListener
  5. android 中文 API (41) —— RatingBar.OnRatingBarChangeListen
  6. android 横纵屏切换
  7. Android中设置中文粗体的方法
  8. Android中文API(142) —— Gravity
  9. 去除listBView的抖动,判断textView中文本长度是不是超过预定值

随机推荐

  1. Android HttpURLConnection网络通信
  2. Android 开发时遇到的两个模拟器问题
  3. 解析Android如何利用Handler
  4. Android官方入门文档[3]构建一个简单的用
  5. TextVview的属性
  6. Android Studio中Gradle使用详解
  7. Android OnTouchListener实时监听触点坐
  8. android 下载文件注意事项
  9. android 如何判断软件是否第一次运行?
  10. Android TextView中链接(link)点击事件的