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

1.如果在xml中

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




2.如果在代码中

(1) 

TextView textView = (TextView)findViewById(R.id.tv_test); 
textView.setText("0123456");

(2)

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

猜你喜欢

转载自blog.csdn.net/u014434239/article/details/51994495
今日推荐