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"
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"
相关文章推荐
- 子线程更新UI会发生android.view.ViewRoot$CalledFromWrongThreadException异常的解决方法
- Android UI事件处理——实现事件监听接口的4种方法
- Android UI编辑器 Unhandled event loop exception解决方法
- Android 使用html做UI的方法---js与java的相互调用
- Android在子线程中更新Activity中UI的方法
- 利用Handler更新Android UI的另一种方法
- Android:UI更新方法三:Handler+Worker Thread
- 子线程更新UI会发生android.view.ViewRoot$CalledFromWrongThreadException异常的解决方法 .
- Android_UI_全屏去掉标题栏和状态栏的两种方法
- Android:UI更新方法一:Handler+View.invalidate+Thread+Runnable
- 2011/06/13 android使用html做UI的方法---js与java的相互调用
- 子线程更新UI会发生android.view.ViewRoot$CalledFromWrongThreadException异常的解决方法 .
- android怎样多个application共享一个进程和异步访问UI的规则及方法
- Android_UI_实现TabHost的两种方法
- 一种简单的 Android UI 优化方法
- Android中实现view的更新UI有两组方法
- 子线程更新UI会发生android.view.ViewRoot$CalledFromWrongThreadException异常的解决方法
- Android Service 通知Activity更新界面的方法研究|Service通过Broadcast更新UI
- 用Handler更新Android Ui的另一种方法
- Android:UI更新方法二:View.postInvalidate+Thread+Runnable