我的活动使用了CollapsingToolbarLayout,我成功删除了StatusBar
这样做:
View decorView = getWindow().getDecorView(); // Hide the status bar. int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN; decorView.setSystemUiVisibility(uiOptions);
问题是,当softkeyboard
弹出时,StatusBar
再次出现,消耗宝贵的空间.
如何让它永久隐藏在ActivityView
?
如果我将它设置为FullScreen,它可以工作,但我松了SOFT_INPUT_ADJUST_RESIZE
参数.主窗口在softkeyboard
显示时滚动,而不是根据需要调整大小.
更新:
代码:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_mchat); this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE ); .. } @Override protected void onResume() { super.onResume(); View decorView = getWindow().getDecorView(); // Hide the status bar. int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN; decorView.setSystemUiVisibility(uiOptions); }
该活动使用NoActionBar方案(在清单上声明).