1. 程式人生 > >android裡TextView加下劃線的幾種方式

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