Android

关注公众号 jb51net

关闭
首页 > 软件编程 > Android > android textview方法

android里TextView加下划线的几种方法总结

投稿:jingxian

下面小编就为大家带来一篇android里TextView加下划线的几种方法总结。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧

如果是在资源文件里:

<resources>
  <string name="hello"><u>phone:0123456</u></string>
  <string name="app_name">MyLink</string>
</resources>

如果是代码里:

TextView textView = (TextView)findViewById(R.id.tv_test); 
textView.setText(Html.fromHtml("<u>"+"0123456"+"</u>"));

代码也可以这样:

tvTest.getPaint().setFlags(Paint. UNDERLINE_TEXT_FLAG ); //下划线
tvTest.getPaint().setAntiAlias(true);//抗锯齿

以上就是小编为大家带来的android里TextView加下划线的几种方法总结全部内容了,希望大家多多支持脚本之家~

您可能感兴趣的文章:
阅读全文