Android全屏显示界面,需要隐藏顶部底部以及status状态栏,可以参考下面的方法隐藏导航栏和状态栏,方法如下,例如在onResume方法上加入:
public void onResume() { super.onResume(); //隐藏底部与顶部导航栏 View decorView = getActivity().getWindow().getDecorView(); int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN; decorView.setSystemUiVisibility(uiOptions); //隐藏状态栏 ((AppCompatActivity)getActivity()).getSupportActionBar().hide(); }
Android显示导航栏与状态栏的方法:
public void onDestroy() { super.onDestroy(); //显示导航栏 View decorView = getActivity().getWindow().getDecorView(); int uiOptions = View.SYSTEM_UI_FLAG_VISIBLE; decorView.setSystemUiVisibility(uiOptions); //显示状态栏 ((AppCompatActivity)getActivity()).getSupportActionBar().show(); }