TextView划线android

TextView 加下划线 、 中划线

下过如图:

\

// 中划线

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

// 下划线

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


//取消设置的线

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


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

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);// 抗锯齿
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值