Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
gkj17 opened this issue Sep 15, 2023 · 4 comments
Closed

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

gkj17 opened this issue Sep 15, 2023 · 4 comments
Labels
question Further information is requested

Comments

@gkj17
Copy link

gkj17 commented Sep 15, 2023

问题描述【必填】

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

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

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

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

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

@gkj17 gkj17 added the question Further information is requested label Sep 15, 2023
@getActivity getActivity changed the title [疑惑]: [疑惑]:请问如何在某些页面隐藏悬浮窗 Sep 16, 2023
@getActivity
Copy link
Owner

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

@gkj17
Copy link
Author

gkj17 commented Sep 25, 2023

轮子哥,我想通过当前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在隐藏->显示的时候,会有一种从右下角飘上来的感觉。

@getActivity
Copy link
Owner

getActivity commented Sep 25, 2023

轮子哥,我想通过当前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在隐藏->显示的时候,会有一种从右下角飘上来的感觉。

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

@getActivity
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants