您的位置:首页 > 产品设计 > UI/UE

android UI小方法

2017-03-28 18:21 344 查看
一:万能去除标题栏

if (getSupportActionBar() != null){
getSupportActionBar().hide();
}

二:Android 5.0以上Material Design沉浸式状态栏

if(Build.VERSION.SDK_INT >= 21) {
View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
getWindow().setStatusBarColor(Color.TRANSPARENT);
}

别忘了在布局中加入
android:fitsSystemWindows="true"
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息