小编Pra*_*bha的帖子

在沉浸式粘滞模式下弹出窗口

当在Android应用程序中使用弹出窗口时,沉浸式粘滞模式似乎不起作用.在弹出窗口期间,状态和导航栏会成为焦点.虽然我能够重置警报对话框的系统UI标志以避免此行为,但我不知道如何为弹出窗口执行此操作.有人可以帮忙吗?

以下是我创建弹出窗口的方法:

LayoutInflater layoutInflater = (LayoutInflater) getActivity().getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View popUpView = layoutInflater.inflate(R.layout.popup_image_selector, null);

 DisplayMetrics displayMetrics = getActivity().getApplicationContext().getResources().getDisplayMetrics();
    int width = displayMetrics.widthPixels;
    int height = displayMetrics.heightPixels;

   final PopupWindow popUp = new PopupWindow(popUpView,(int) (width*0.66), (int)(height*.20));
    popUp.setFocusable(true);
    popUp.setOutsideTouchable(true);

popUp.setContentView(popUpView);
    popUp.showAtLocation(imageContent, Gravity.BOTTOM, 0, (int)(height*.20));
Run Code Online (Sandbox Code Playgroud)

我在哪里可以设置系统UI标志,因为我不能够访问getWindow().setFlags或getWindow().getDecorView的弹出窗口.

感谢任何帮助!

谢谢!

popupwindow android-immersive

6
推荐指数
0
解决办法
529
查看次数

标签 统计

android-immersive ×1

popupwindow ×1