0
我有一個全屏的活動。我正在使用下面的代碼(我在onResume方法中調用)進行全屏活動:關閉Android PopUpWindow對象使狀態欄可見。如何阻止此?
int currentApiVersion = Build.VERSION.SDK_INT;
final int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
// This work only for android 4.4+
if (currentApiVersion >= Build.VERSION_CODES.KITKAT) {
activity.getWindow().getDecorView().setSystemUiVisibility(flags);
// Code below is to handle presses of Volume up or Volume down.
// Without this, after pressing volume buttons, the navigation bar will
// show up and won't hide
final View decorView = activity.getWindow().getDecorView();
decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
@Override
public void onSystemUiVisibilityChange(int visibility) {
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
decorView.setSystemUiVisibility(flags);
}
}
});
}
在這個活動中,我打開了一個PopUpWindow對象。但打開後,狀態欄變得可見。如何阻止此?
對於表示PopUpWindow,我使用下面的代碼:
popupWindow =新PopupWindow(佈局,RelativeLayout.LayoutParams.MATCH_PARENT,RelativeLayout.LayoutParams.MATCH_PARENT,TRUE); popupWindow.showAtLocation(layout,Gravity.NO_GRAVITY,0,0);
我無法弄清楚,這些方法有什麼問題。請幫忙。提前致謝。
是的,它的工作。謝謝。 –