从TextView中删除删除线 [英] Removing Strikethrough from TextView

查看:249
本文介绍了从TextView中删除删除线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用这条线以下,以我的TextView中设置了删除线:

I'm using this line below in order to set a strikethrough on my TextView:

tv.setPaintFlags(tv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);

不过后来在片段,如果他们再次单击TextView的,我想删除线将被删除。我可以使用哪些线code简单地使TextView中再次显示在正常格式的文本?

However later on in the Fragment, if they click the TextView again, I would like the strikethrough to be removed. What line of code can I use to simply make the TextView display the text in the normal format again?

在此先感谢!

推荐答案

我最终找到本次网上:

tv.setPaintFlags(tv.getPaintFlags() & (~ Paint.STRIKE_THRU_TEXT_FLAG));

这成功地消除了删除线,所以我在执行数据库的检查后, OnListItemClick 方法中调用这个我做了,看看该项目已经通过删除线(在我的情况购买)。

This successfully removes the strikethrough and therefore I called this in my OnListItemClick method after carrying out a check in the database I made to see if the item had already been striked through (purchased in my case).

这篇关于从TextView中删除删除线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆