android里TextView加下划线的几种方式

时间:2014-07-16 21:11:27   收藏:0   阅读:369

如果是在资源文件里:

 <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加下划线的几种方式,布布扣,bubuko.com

原文:http://www.cnblogs.com/error404/p/3836225.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!