简体   繁体   中英

On Android, How to create global screen overlay for my app?

I want to display some icon as alert for my app.

I know there are screen dimmer/filter apps that can do the thing on Android, but I cannot find technical reference on the topic from google.

Anyone can point me the way?

  • using context.getSystemService(Context.WINDOW_SERVICE) to get a WindowManager

  • create layoutParams: WindowManager.LayoutParams(-2, -2, TYPE_APPLICATION_OVERLAY, 0, PixelFormat.TRANSLUCENT)

  • create view using context

  • then use WindowManager.addView

  • may need to add permission android.permission.SYSTEM_ALERT_WINDOW

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM