Android: 在 TextView 里使用删除线
2015-10-29 16:40
330 查看
Android: 在 TextView 里使用删除线
分类: Android2014-09-25 13:17 3431人阅读 评论(0) 收藏 举报以编程的方式添给 TextView 添加删除线:
[java] view plaincopy
textview.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
顺便研究下:
TextView.getPaint() :
[java] view plaincopy
// Returns the base paint used for the text.
// Please use this only to consult the Paint's properties and not to change them.
public TextPaint getPaint();
TextPaint:
[java] view plaincopy
// TextPaint is an extension of Paint that leaves room
// for some extra data used during text measuring and drawing.
public class TextPaint extends Paint {...}
Paint:
[java] view plaincopy
// The Paint class holds the style and color information
// about how to draw geometries, text and bitmaps.
public class Paint extends Object {...}
Paint.setFlags():
[java] view plaincopy
// Set the paint's flags. Use the Flag enum to specific flag values.
// flags: The new flag bits for the paint
public void setFlags (int flags);
Paint.STRIKE_THRU_TEXT_FLAG:
[java] view plaincopy
// Paint flag that applies a strike-through decoration to drawn text.
// Constant Value: 16 (0x00000010)
public static final int STRIKE_THRU_TEXT_FLAG;
参考资料:
TextView | Android Developers http://developer.android.com/reference/android/widget/TextView.html
TextPaint | Android Developers http://developer.android.com/reference/android/text/TextPaint.html
Paint | Android Developers http://developer.android.com/reference/android/graphics/Paint.html
http://blog.csdn.net/lilin_emcc/article/details/39549541
相关文章推荐
- Android中实现两次点击返回键退出本程序
- Android Handler加massage
- android开发Fragment not attached to Activity异常解决
- Android内存泄漏检测-LeakCanary
- Spinner 的 点击问题
- Android开发——Intent中的各种FLAG
- Android总结篇系列:Android Intent
- Android Service
- Android总结篇系列:Android广播机制
- 使用AndroidStudio一分钟实现Navigation Drawer 导航抽屉效果
- Android取消EditText自动获取焦点默认行为
- 五种控制Android应用的权限的方法
- Android启动外部Activity时必须添加的Flag
- Android高效加载大图、多图解决方案(LruCache)
- Android android:clickable 问题
- Android定时器
- android LinearLayout android:baselineAligned属性
- Android圆形图片--自定义控件
- 【Android】ToolBar设置NavigationIcon不显示异常或自定义失败异常
- Android (DiskLruCache)硬盘缓存代码实现