您的位置:首页 > 移动开发 > Android开发

TextView划线android

2015-10-23 11:29 477 查看
TextView 加下划线 、 中划线

下过如图:



// 中划线

view
sourceprint?

1.
textView.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG
| Paint.ANTI_ALIAS_FLAG); 
//
设置中划线并加清晰


// 下划线

view
sourceprint?

1.
textView.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);


//取消设置的线

view
sourceprint?

1.
textView.getPaint().setFlags(
0
); 
//
取消设置的的划线


我封装了几个方法 直接调用

view
sourceprint?

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
);
//
抗锯齿
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: