Android: 在 TextView 裡使用刪除線

來源:互聯網
上載者:User

標籤:

 Android: 在 TextView 裡使用刪除線分類: Android2014-09-25 13:17 3431人閱讀 評論(0) 收藏 舉報以編程的方式添給 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;  

 

參考資料:

  • 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 裡使用刪除線

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.