Removing Strikethrough from TextView

*爱你&永不变心* 提交于 2019-11-28 22:31:51

I ended up finding this online:

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

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).

Another way is to simply set value of setPaintFlags to Zero.

tv.setPaintFlags(0) 

NOTE: This will remove strike through your text.

You can set an OnClickListener on the TextView, reset the paint flags, and call its invalidate() so it redraws itself.

Setting up AntiAlias helped me to make text look less distored

Kotlin

tv.paintFlags = Paint.ANTI_ALIAS_FLAG
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!