TextView划线android

一时失言乱红尘 2022-08-09 12:42 319阅读 0赞

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``);``// 抗锯齿

发表评论

表情:
评论列表 (有 0 条评论,319人围观)

还没有评论,来说两句吧...

相关阅读

    相关 Android 文本视图TextView

    TextView想必大家都很熟悉了,不管在哪门语言中,文本显示是最为基础的。TextView的基本属性有很多,我就不一一介绍了。这里我们直接通过几个例子来看下TextView的