Android 4.4 上实现透明导航栏和状态栏 Translucent system bar
2015-05-25 21:35
696 查看
Translucent system UI styling To get the most impact out of your content, you can now use new window styles and themes to request translucent system UI, including both the status bar and navigation bar. To ensure the legibility of navigation bar buttons or status bar information, subtle gradients is shown behind the system bars. A typical use-case would be an app that needs to show through to a wallpaper.
这个是Android Developer上的原文 反正我也看得不是很懂 我知道的就是实现和导航栏和状态栏的透明 带一些渐变效果
1. 设置主题
<style name="Theme.Timetodo" parent="@android:style/Theme.Holo.Light"> <!-- translucent system bars --> <item name="android:windowTranslucentStatus">true</item> <item name="android:windowTranslucentNavigation">true</item> </style>
添加了这两个属性之后 就是是这个效果了 可以看到 listview已经被顶到上面去了 不知道是不是bug 查了下资料 目前的解决办法好像都是给layout设置padding来解决
2.设置颜色和设置padding
private void initSystemBar() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { setTranslucentStatus(true); SystemBarTintManager tintManager = new SystemBarTintManager(this); tintManager.setStatusBarTintEnabled(true); tintManager.setStatusBarTintResource(R.color.actionbar_bg); SystemBarConfig config = tintManager.getConfig(); listViewDrawer.setPadding(0, config.getPixelInsetTop(true), 0, config.getPixelInsetBottom()); } }
3.最终效果
参考资料:
http://mindofaandroiddev.wordpress.com/2013/12/28/making-the-status-bar-and-navigation-bar-transparent-with-a-listview-on-android-4-4-kitkat/http://stackoverflow.com/questions/20781014/translucent-system-bars-and-content-margin-in-kitkat
相关文章推荐
- Android 4.4 上实现透明导航栏和状态栏 Translucent system bar
- Android 4.4 以上实现透明导航栏和状态栏 Translucent system bar
- Android 4.4 实现透明状态栏Translucent system bar(Status bar)
- Android中 4.4-5.0 系统状态栏颜色的修改。实现Translucent System Bar
- Android使用fitsSystemWindows属性实现--状态栏【status_bar】各版本适配方案
- Android 4.4+实现透明状态栏( transparent status bar)
- android 4.4 支持透明状态栏和透明导航栏
- 转-android沉浸式状态栏:Translucent System Bar 的最佳实践
- Android使用fitsSystemWindows属性实现--状态栏【status_bar】各版本适配方案
- Android 4.4 以上分分钟实现状态栏伪沉浸(状态栏透明)
- Android使用fitsSystemWindows属性实现–状态栏【status_bar】各版本适配方案
- Android使用fitsSystemWindows属性实现–状态栏【status_bar】各版本适配方案
- Android使用fitsSystemWindows属性实现–状态栏【status_bar】各版本适配方案
- 【Android基础学习】Android使用fitsSystemWindows属性实现–状态栏【status_bar】各版本适配方案
- Android实现4.4以上系统状态栏透明
- Android 4.4 后透明状态栏和导航栏效果实现(学习总结)
- android 4.4 支持透明状态栏和透明导航栏
- Android 4.4+ 实现半透明状态栏(Translucent Bars)
- android 4.4版本以上透明状态栏的简单实现
- Android使用fitsSystemWindows属性实现--状态栏【status_bar】各版本适配方案