软件编程
位置:首页>> 软件编程>> Android编程>> android里TextView加下划线的几种方法总结

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

作者:jingxian  发布时间:2022-03-25 10:42:18 

标签: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);//抗锯齿
0
投稿

猜你喜欢

手机版 软件编程 asp之家 www.aspxhome.com