android TextView控件文字下划线

如果在代码里边写的话,可以这样实现:

  1. TextView tv = (TextView) findViewById(R.id.text);  
  2. tv.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);  
  3. tv.setText("添加下划线");

在配置文件中,values/strings.xml中

<string name="kidoustatus"><u>添加下划线</u></string>

还可以这样写:

 tv.setText(Html.fromHtml("<u>使用html实现下划线样式</u>"));

猜你喜欢

转载自coderzhcn.iteye.com/blog/1942840