標籤:
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: 在 TextView 裡使用刪除線