Android custom app global hover button

Originally, I wanted to implement a button suspended on other controls through FrameLayout, but I felt it was very troublesome and needed to dynamically fill all interfaces. So I thought of the suspended window and customized an ImageView to display global buttons

1、 First, because of the suspended window, you need to add permissions. For SDK > = 23, you need to obtain permissions dynamically. I use 22

2、 Obtain the params data of the global WindowManager through the application

3、 Customize the ImageView and realize that clicking has state selection. A callback interface is written to handle clicking events

4、 Used in activity, including setting picture parameters and location parameters

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>