如果是在资源文件里,可以这样写
Java代码 1. <resources>
2. <string name="hello"><u>phone: 1390123456</u></string>
3. <string name="app_name">MyLink</string>
4. </resources>
如果是代码这样写.
Java代码
1. TextView textView = (TextView)findViewById(R.id.testView);
2. textView.setText(Html.fromHtml("<u>"+"hahaha"+"</u>"));
textView.getPaint().setFlags(Paint. UNDERLINE_TEXT_FLAG ); //下划线 textView.getPaint().setAntiAlias(true);//抗锯齿 textview.getPaint().setFlags(Paint. STRIKE_THRU_TEXT_FLAG); //中划线 setFlags(Paint. STRIKE_THRU_TEXT_FLAG|Paint.ANTI_ALIAS_FLAG); // 设置中划线并加清晰 textView.getPaint().setFlags(0); // 取消设置的的划线
|