分类: Android2014-09-25 13:17 3431人阅读 评论(0) 收藏 举报
以编程的方式添给 TextView 添加删除线:

  1. textview.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);

顺便研究下:

TextView.getPaint() :

  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:

  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:

  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():

  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:

  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 里使用删除线的更多相关文章

  1. Android在一个TextView里显示不同样式的字体

    在同一个TextView里显示不同样式的字体 public void setSpan(Object what, int start, int end, int flags); 样式1:背景色.粗体.字 ...

  2. Android TextView里显示两种颜色

    今天介绍一个小技巧,在Android的TextView里设置两种颜色,直接上代码: TextView TV = (TextView)findViewById(R.id.mytextview01); S ...

  3. Android中TextView添加删除线

    项目中的需求~~~~ 商城中物品的一个本身价格,还有一个就是优惠价格...需要用到一个删除线. public class TestActivity extends Activity { private ...

  4. 【转】Android TextView SpannableStringBuilder 图文混排颜色斜体粗体下划线删除线

    spannableStringBuilder 用法详解: SpannableString ss = new SpannableString("红色打电话斜体删除线绿色下划线图片:." ...

  5. Android之TextView的样式类Span的使用详解

           Android中的TextView是个显示文字的的UI类,在现实中的需求中,文字有各式各样的样式,TextView本身没有属性去设置实现,我们可以通过Android提供的 Spannab ...

  6. 【Android】 TextView设置个别字体样式

    SpannableString msp = new SpannableString("测试"+XM+"更换当前号码将从手机发送一条普通短信进行验证"); msp ...

  7. TextView里的文 html

    一.[Android实例]实现TextView里的文字有不同颜色 转eoe:http://www.eoeandroid.com/thread-4496-1-1.html import android. ...

  8. [Android教程]TextView使用SpannableString设置复合文本

    TextView通常用来显示普通文本,但是有时候需要对其中某些文本进行样式.事件方面的设置.Android系统通过SpannableString类来对指定文本进行相关处理,具体有以下功能: 1.Bac ...

  9. Android的TextView使用Html来处理图片显示、字体样式、超链接等

    一.[Android实例]实现TextView里的文字有不同颜色 转eoe:http://www.eoeandroid.com/thread-4496-1-1.html import android. ...

随机推荐

  1. 4 Values whose Sum is 0_upper_bound&&ower_bound

    Description The SUM problem can be formulated as follows: given four lists A, B, C, D of integer val ...

  2. Response响应请求操作

    using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Te ...

  3. arcgis显示其他国家语言

    接手一个韩国的项目,需要在arcmap中配置一个韩国地图并发布到arcserver中进行切图,给的韩国地图的shapefile文件中属性字段都是韩文的,在中文的系统中,arcMap中显示的韩文都是乱码 ...

  4. 请问用Inno_Setup打包文件夹时怎么排除其中一个文件?

    请问用Inno_Setup打包文件夹时怎么排除其中一个文件? 该文件夹下有几十个文件,多个文件夹,我要一个个加进去该累死,也容易出问题.不知道能不能实现我要的目的. http://www.jrsoft ...

  5. Bootstrap组件On和Off语法

    $(document).on('click.bs.carousel.data-api','td',function(e){}) $(document).off('.carousel.data-api' ...

  6. Disable Portrait in app

    I had this problem as well as I wanted to constrain my game to only landscape mode. I put this in my ...

  7. 第一个Sprint冲刺第十天

    讨论成员:邵家文.李新.朱浩龙.陈俊金 工作:第一个计时功能完成,还有一些复杂的公式已完成.          关于github其实我们团队,还没有搞清楚github的真正用途,我们尚要花时间去学习如 ...

  8. Autoresizing和AutoLayout

    1 使用Autoresizing的方式进行界面布局 1.1 问题 Autoresizing是IOS旧版的自动布局技术,现在仍然被很多企业使用.本案例将学习如何使用Autoresizing完成界面的布局 ...

  9. "Your local changes to the following files would be overwritten by merge" on git

    运行: git merge --ff origin/master 得到错误信息: error: Your local changes to the following files would be o ...

  10. What books does Bjarne Stroustrup suggest to master C++?

    QUESTION : What books does Bjarne Stroustrup suggest to master C++? ANSWER: A Tour of C++ is a quick ...