TextView划线android
TextView 加下划线 、 中划线
下过如图:
// 中划线
view source print ?
1.
textView.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); ``// 设置中划线并加清晰
// 下划线
view source print ?
1.
textView.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);
//取消设置的线
view source print ?
1.
textView.getPaint().setFlags(``0``); ``// 取消设置的的划线
我封装了几个方法 直接调用
view source print ?
01.
/**
02.
* 下划线
03.
*
04.
* @param textView
05.
*/
06.
private
void
addButtomLine(TextView textView) {
07.
textView.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);
08.
}
09.
10.
/**
11.
* 移除线
12.
*
13.
* @param textView
14.
*/
15.
private
void
removeLine(TextView textView) {
16.
textView.getPaint().setFlags(``0``); ``// 取消设置的的划线
17.
18.
}
19.
20.
/**
21.
* 设置中划线并加清晰
22.
*
23.
* @param textView
24.
*/
25.
private
void
addLine(TextView textView) {
26.
textView.getPaint().setFlags(
27.
Paint.STRIKE_THRU_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); ``// 设置中划线并加清晰
28.
29.
}
30.
31.
/**
32.
* 中划线
33.
*
34.
* @param textView
35.
*/
36.
private
void
addCenterLine(TextView textView) {
37.
textView.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG); ``// 中划线
38.
}
39.
40.
/**
41.
* 抗锯齿
42.
*
43.
* @param textView
44.
*/
45.
private
void
addjuchiLine(TextView textView) {
46.
textView.getPaint().setAntiAlias(``true``);``// 抗锯齿
还没有评论,来说两句吧...