android studio创建默认app总是自带一个导航栏,尤其不好看,而且对某些手机总和手机自己的时间状态栏打架。
搞了好几种办法取消了,然后进行优化布局还不错
// 隐藏 ActionBar
supportActionBar?.hide()
// 如果使用 Toolbar 替代 ActionBar
// setSupportActionBar(toolbar)
// supportActionBar?.hide()
// 显示时间状态栏并设置状态栏文字为深色
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
// 隐藏ActionBar
if (getSupportActionBar() != null) {
getSupportActionBar().hide();
}
相较于java,kt更能简单