status bar使用
来源:互联网 发布:mysql 5.17 ngram 编辑:程序博客网 时间:2024/06/14 19:49
一、设置状态栏
1、This lesson describes how to dim the system bars (that is, the status and the navigation bars) on Android 4.0 (API level 14) and higher. Android does not provide a built-in way to dim the system bars on earlier versions.
**覆盖状态栏
setContentView(R.layout.activity_main); View decorView = getWindow().getDecorView(); int uiOptions = View.SYSTEM_UI_FLAG_LOW_PROFILE;//This is for use in games, book readers, video players, or any other decorView.setSystemUiVisibility(uiOptions);
看一下状态栏对比
显示状态栏 :切换的试下显示
View decorView = getActivity().getWindow().getDecorView();// Calling setSystemUiVisibility() with a value of 0 clears// all flags. decorView.setSystemUiVisibility(0);
参考: https://developer.android.com/training/system-ui/dim.html
二、Hiding the Status Bar
Hide the Status Bar on Android 4.0 and Lower
public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // If the Android version is lower than Jellybean, use this call to hide // the status bar. if (Build.VERSION.SDK_INT < 16) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } setContentView(R.layout.activity_main); } ...}
在2.3的模拟器上的效果
还有一种方式 设置style,一跑就崩溃
Hide the Status Bar on Android 4.1 and Higher
View decorView = getWindow().getDecorView();// Hide the status bar.int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;decorView.setSystemUiVisibility(uiOptions);// Remember that you should never show the action bar if the// status bar is hidden, so hide that too if necessary.ActionBar actionBar = getActionBar();actionBar.hide();
0 0
- status bar使用
- Status.Bar.Notifications的使用
- Status bar
- iOS 使用Method Swizzling隐藏Status Bar
- android status bar 之 status bar notifications
- status bar 、action bar、navigation bar height
- System Bar (Status Bar Navigation Bar)
- ios7中让程序使用统一的status bar风格
- Android Status Bar
- Status Bar Notifications
- 隐藏Status Bar
- Status Bar Notification
- Expand Status bar
- Status Bar Notification
- iOS自定义Status Bar
- 获取status bar 高度
- 隐藏Status Bar
- 学习status bar notification
- java线程基础
- 把MyEclipse中的项目部署到服务器
- 横竖屏切换时候Activity的生命周期
- 文章标题
- 欢迎使用CSDN-markdown编辑器
- status bar使用
- Android中悬浮窗口的实现原理和示例代码
- android ellipsize multiline textview
- 基础练习——进制转换
- bash
- Redis 和 Memcached 的区别详解
- 微信网页授权获取用户基本信息--PHP
- JVM虚拟机内存模型以及GC机制
- webservice的注解