In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Android on the suspension window lock screen or disappear after screenshot solution, I believe that many inexperienced people do not know what to do, so this paper summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
Today we will talk about the problems encountered when locking the android8.1 screen.
Problems and solutions
Our program works well under android8.1, but if we lock the screen or capture the screen, our suspension window will disappear by itself.
These are the two I'm trying to get, but I think this will happen when something else gets in the way at the top. Because when looking up the code, we found that the view in our windowsmanage still exists, but it just doesn't show it.
In order not to affect the effectiveness of the use and to solve this problem more simply, I think of a way to do a count every time the windowsmanage is refreshed, and we delete the view and re-create it after how many times it is refreshed.
Realize the effect
As can be seen in the above video, after we made a screenshot, the suspension window disappeared automatically for a while, but it was automatically displayed again soon.
Core code
To achieve a removable suspension window effect, we can see the code in the article "Android implements a removable suspension window". We are only talking about the solution here.
First of all, we need to modify the updaetUsedPercent function in MyWindowManage and add a value of boolean to the parameter to determine whether to rebuild the View. If so, we can delete the original view and then re-addview. If not, just update the original code directly. The red box in the picture below is our newly added judgment section.
To prevent the previous call from being changed, we have built an overloaded method so that it does not refresh by default when the following parameters are not entered.
Then let's take a look at the code that calls this update method in the service of FloatWindow
First of all, we added an int type variable of updatetimes, and then the green box above is the original code, we just modified it here, when the number of updatetimes is greater than 10, we will delete the View in windowmanage and recreate it, then reset the updatetimes to 0, when it is less than 10, refresh the View according to the original timing, and then updatetimes add 1.
After reading the above, have you mastered Android's solution to the problem of floating window locking screen or disappearing after screenshot? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
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.