Creating a system overlay window (always on top)

前端 未结 16 945
南方客
南方客 2020-11-21 07:07

I\'m trying to create an always-op-top button/clickable-image which stays on top of all the windows all the time.

The proof of concept is

  • here - Smar
16条回答
  •  我在风中等你
    2020-11-21 07:14

    TYPE_SYSTEM_OVERLAY This constant was deprecated in since API level 26. Use TYPE_APPLICATION_OVERLAY instead. or **for users below and above android 8

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        LAYOUT_FLAG = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
    } else {
        LAYOUT_FLAG = WindowManager.LayoutParams.TYPE_PHONE;
    }
    

提交回复
热议问题