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添加下划线的多种方法。包括在资源文件中使用HTML标签和在代码中直接设置Paint的Flags来实现下划线效果。
1171

被折叠的 条评论
为什么被折叠?



