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

来源:互联网 发布:非诚勿扰交友软件 编辑:程序博客网 时间:2024/05/15 12:10

如果是在资源文件里:

 <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);//抗锯齿

转载自:http://write.blog.csdn.net/postedit?ref=toolbar&ticket=ST-41280-GjMsk6laQUoQY3UnFnk5-passport.csdn.net

0 0
原创粉丝点击