getActivity / EasyWindow

Android 悬浮窗框架,好用不解释

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[疑惑]:请问如何在某些页面隐藏悬浮窗

gkj17 opened this issue · comments

问题描述【必填】

请问如何在某些页面不显示(隐藏)悬浮窗呢?我以为是通过setWindowAlpha,但这样即使alpha为0 在页面不显示,但是还是会点击到

框架文档是否提及了该问题【必答】

是否已经查阅框架文档但还未能解决的【必答】

issue 列表中是否有人曾提过类似的问题【必答】

是否已经搜索过了 issue 列表但还未能解决的【必答】

小伙子,你直接监听 Activity 生命周期,如果遇到特定的 Activity 的时候,直接取消显示悬浮窗,这样实现是否能满足你的需求?

轮子哥,我想通过当前topActivity判断是否显示,我的方法是

    private val checkOnLauncherRunnable = object : Runnable {
        override fun run() {
          //判断是否在launcher
          if (isLauncherOnTop(this@MainActivity)) {
            myWindow.setWidth(0)
              .setHeight(0)
          } else {
            myWindow.setWidth(WINDOW_WIDTH - STEP)
              .setHeight(WINDOW_HEIGH - STEP)
          }
          // 通过postDelayed方法实现每隔一秒钟执行一次
          handler.postDelayed(this, CHECK_LAUNCHER_MILLION)
        }
      }

通过修改window的宽高实现,但是当window在隐藏->显示的时候,会有一种从右下角飘上来的感觉。

轮子哥,我想通过当前topActivity判断是否显示,我的方法是

    private val checkOnLauncherRunnable = object : Runnable {
        override fun run() {
          //判断是否在launcher
          if (isLauncherOnTop(this@MainActivity)) {
            myWindow.setWidth(0)
              .setHeight(0)
          } else {
            myWindow.setWidth(WINDOW_WIDTH - STEP)
              .setHeight(WINDOW_HEIGH - STEP)
          }
          // 通过postDelayed方法实现每隔一秒钟执行一次
          handler.postDelayed(this, CHECK_LAUNCHER_MILLION)
        }
      }

通过修改window的宽高实现,但是当window在隐藏->显示的时候,会有一种从右下角飘上来的感觉。

小伙子,我说的那种方案是没有办法实现你的需求么?

超过一个星期没有响应,自动关闭此 issue。