以半透明的状态栏的优势,Android的4.4奇巧 [英] Taking advantage of the translucent status bar in Android 4.4 KitKat

查看:147
本文介绍了以半透明的状态栏的优势,Android的4.4奇巧的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我发表我的笔记应用程序的Andr​​oid 4.0 - 4.3我使用(而不是使用标准的光明与黑暗的动作条)自定义操作栏的颜色自定义操作栏图标。我想使它所以在Android 4.4系统,状态栏也将承担我用我的行动吧(这是#FFD060)的自定义颜色。有没有一种方法可以轻松地改变我目前的styles.xml让4.4充分利用这个优势?

When I released my note taking application for Android 4.0 - 4.3 I used a custom action bar color with a custom action bar icon (instead of using the standard light and dark action bars). I would like to make it so on Android 4.4, the status bar will also take on the custom color I am using in my Action Bar (which is #FFD060). Is there a way to easily change my current styles.xml to allow 4.4 to take advantage of this?

我在我的价值观,V19文件夹styles.xml如下:

My styles.xml under my values-v19 folder is as follows:

<resources>

<style name="AppBaseTheme" parent="@android:style/Theme.Holo.Light">
   <item name="android:actionBarStyle">@style/MyActionBarTheme</item>
</style>

 <style name="MyActionBarTheme" parent="@android:style/Widget.Holo.Light.ActionBar">
     <item name="android:background">#ffd060</item>
     <item name="android:textColor">#fff</item>   
     <item name="android:icon">@drawable/action</item>
     <item name="android:titleTextStyle">@style/MyTextAppearance</item>
 </style>

 <style name="MyTextAppearance" parent="android:TextAppearance.Holo.Widget.ActionBar.Title">
     <item name="android:icon">@drawable/action</item>
     <item name="android:textColor">#ffffff</item>
 </style>
</resources>

我试图实现:

I have tried to implement:

 <item name="android:windowTranslucentStatus">true</item>

这导致我的应用程序的内容上移,开始在状态栏区域,并覆盖的操作栏。

It causes the contents of my application to move up, start in the status bar area and be covered by the Action Bar.

推荐答案

更新:从找到的马特·冈特(谷歌的员工)上添加一个半透明的主题为Android应用程序。这是非常透彻,并解决了一些问题,很多人似乎在实施这种风格是具有:的 Android中半透明主题

Update: Found this great article from Matt Gaunt (a Google Employee) on adding a Translucent theme to Android apps. It is very thorough and addresses some of the issues many people seem to be having while implementing this style: Translucent Theme in Android

只需添加以下到您的自定义样式。此prevents背后的动作条和最多的窗口的顶部,不知道屏幕虽然底部的内容的移动。

Just add the following to your custom style. This prevents the shifting of the content behind the ActionBar and up to the top of the window, not sure about the bottom of the screen though.

<item name="android:fitsSystemWindows">true</item>

贷:<一href="http://stackoverflow.com/questions/20167755/transparent-status-bar-system-ui-on-4-4-kit-kat">Transparent状态栏系统UI上洁吉

这篇关于以半透明的状态栏的优势,Android的4.4奇巧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆