gpt4 book ai didi

android - 弹出窗口在沉浸模式下显示有空格/间隙,仅在 Marshmallow 上

转载 作者:行者123 更新时间:2023-11-29 01:18:40 25 4
gpt4 key购买 nike

特别是在 Marshmallow 上(在 Nexus 5X 和 6P 上测试过)当我在沉浸式模式下在屏幕上打开 PopupWindow(具有 match_parent 宽度和高度)时,弹出窗口的内容不会展开到全屏时,导航按钮曾经所在的位置有一个空隙。效果就好像不可见的导航按钮仍然存在,增加了空格/间隙/边距。

这就是我创建弹出窗口的方式:

PopupWindow popup = new PopupWindow(popupView, FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.MATCH_PARENT, false);

popup.showAtLocation(activity.findViewById(R.id.full_screen_root_view), Gravity.CENTER, 0, 0);

这是弹出布局的开始:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/popup"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
android:background="#AA000000">

这是显示弹出窗口的全屏 View :

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/full_screen_root_view"
android:background="@android:color/black">

您知道 Marshmallow 是否有任何变化会导致此错误吗?在 Nexus 5、5.0.1 版和我测试过的其他旧手机/版本中,一切都运行良好。先感谢您! :)

最佳答案

我以前遇到过这个问题。我通过在显示之前将 PopupWindow focusable 设置为 false 来解决。

PopupWindow mWindow = new PopupWindow(context);
mWindow.setFocusable(false);
mWindow.showAtLocation(anchor, Gravity.NO_GRAVITY, xPos, yPos);

关于android - 弹出窗口在沉浸模式下显示有空格/间隙,仅在 Marshmallow 上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38155268/

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