In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to set and cancel the delete line in android TextView". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to set and cancel delete lines in android TextView".
1. There are two ways to set delete lines in TextView:
(recommended) method 1:
Set the original Flags property of TextView with the delete line by bitwise or operator |. TextView is redrawn within setPaintFlags.
Tv.setPaintFlags (tv.getPaintFlags () | Paint.STRIKE_THRU_TEXT_FLAG)
Method 2:
Set the properties after getting the brush and redraw the TextView. There is a problem with this approach, which replaces the original Flags attribute of TextView, such as anti-aliasing, etc. If you look closely, you will find that the text is aliased in this way.
Tv.getPaint (). SetFlags (Paint.STRIKE_THRU_TEXT_FLAG); tv.invalidate ()
2. There are two ways to cancel the delete line in TextView:
(recommended) method 1:
First reverse the Paint.STRIKE_THRU_TEXT_FLAG attribute, and then use the bitwise and operator & to remove the delete line attribute and retain the original Flags attribute of TextView. TextView is redrawn within setPaintFlags.
Tv.setPaintFlags (tv.getPaintFlags () & (~ Paint.STRIKE_THRU_TEXT_FLAG))
Method 2:
After getting the brush, clear the Flags property and redraw the TextView. There is a problem with this approach, which clears all the original Flags attributes of TextView, such as anti-aliasing, and so on. If you look closely, you will find that the text is aliased in this way.
Tv.getPaint (). SetFlags (0); tv.invalidate (); at this point, I believe you have a better understanding of "how to set and cancel delete lines in android TextView". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.