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);//抗鋸齒

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章