码迷,mamicode.com
首页 > 移动开发 > 详细

Android: 在 TextView 里使用删除线

时间:2015-10-29 17:46:56      阅读:293      评论:0      收藏:0      [点我收藏+]

标签:

 

Android: 在 TextView 里使用删除线

分类: Android
以编程的方式添给 TextView 添加删除线:
[java] view plaincopy技术分享技术分享
 
  1. textview.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);  

顺便研究下:

TextView.getPaint() :

[java] view plaincopy技术分享技术分享
 
  1. // Returns the base paint used for the text.  
  2. // Please use this only to consult the Paint‘s properties and not to change them.  
  3. public TextPaint getPaint();  

TextPaint:

[java] view plaincopy技术分享技术分享
 
  1. // TextPaint is an extension of Paint that leaves room   
  2. // for some extra data used during text measuring and drawing.  
  3. public class TextPaint extends Paint {...}  

Paint:

[java] view plaincopy技术分享技术分享
 
  1. // The Paint class holds the style and color information  
  2. // about how to draw geometries, text and bitmaps.  
  3. public class Paint extends Object {...}  

Paint.setFlags():

[java] view plaincopy技术分享技术分享
 
  1. // Set the paint‘s flags. Use the Flag enum to specific flag values.  
  2. // flags: The new flag bits for the paint  
  3. public void setFlags (int flags);  

 

Paint.STRIKE_THRU_TEXT_FLAG:

[java] view plaincopy技术分享技术分享
 
  1. // Paint flag that applies a strike-through decoration to drawn text.  
  2. // Constant Value: 16 (0x00000010)  
  3. public static final int STRIKE_THRU_TEXT_FLAG;  

 

参考资料:

http://blog.csdn.net/lilin_emcc/article/details/39549541

Android: 在 TextView 里使用删除线

标签:

原文地址:http://www.cnblogs.com/cmblogs/p/4920942.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!