gpt4 book ai didi

android - 如何在键盘下绘制其他应用程序?

转载 作者:太空狗 更新时间:2023-10-29 13:57:09 25 4
gpt4 key购买 nike

我正在开发一个在屏幕上绘制气泡的 float 应用程序。我想让气泡在出现时始终位于键盘下方,或者至少捕获键盘事件。

这是我用来将气泡添加到窗口管理器的参数代码:

         params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
| WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
PixelFormat.TRANSLUCENT);

我已经尝试了所有窗口类型/标志,但无法实现。我知道这是可能的,因为“EAS: easy app switcher”做到了。

我真的希望有人能在这方面启发我。提前感谢您的宝贵时间!

最佳答案

我刚刚遇到了同样的问题,终于找到了解决方案。虽然它可能不会再帮助您,但希望它能帮助遇到同样问题的其他人。

需要的标志是 WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IMWindowManager.LayoutParams.FLAG_NOT_FOCUSABLE 的组合。

这是 javadoc 中关于标志的内容:

    /** Window flag: invert the state of {@link #FLAG_NOT_FOCUSABLE} with
* respect to how this window interacts with the current method. That
* is, if FLAG_NOT_FOCUSABLE is set and this flag is set, then the
* window will behave as if it needs to interact with the input method
* and thus be placed behind/away from it; if FLAG_NOT_FOCUSABLE is
* not set and this flag is set, then the window will behave as if it
* doesn't need to interact with the input method and can be placed
* to use more space and cover the input method.
*/

关于android - 如何在键盘下绘制其他应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38521391/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com