安卓windowActionBarOverlay&放大器;机器人:actionBarStyle需要API级别11 [英] android:windowActionBarOverlay & android:actionBarStyle requires api level 11
问题描述
我想提出一个Android应用程序,并采用了android支持-V7-应用程序兼容性,使来自Android版本2.2确保我的应用程序支持的动作条以上。
I am making an android app and using android-support-v7-appcompat to make sure my app support action bars from android version 2.2 and up.
我需要的操作栏叠加和使用半透明的背景,所以我已经修改了styles.xml这个code:
I need to make the Action Bar overlay and use a translucent background so I have modified the styles.xml to this code :
<resources>
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<!-- TRANSLUCENT THEME -->
<style name="TranslucentAB" parent="Theme.AppCompat.Light">
<item name="windowActionBarOverlay">true</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="android:actionBarStyle">@style/BlackBar</item>
<item name="actionBarStyle">@style/BlackBar</item>
</style>
<!-- TRANSLLUCENT COLOR STYLE -->
<style name="BlackBar" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background">@drawable/halfblack</item>
<item name="background">@drawable/halfblack</item>
</style>
</resources>
和修改清单文件,以适应新的动作条为:
and modified manifest file to adapt the new ActionBar as :
android:theme="@style/TranslucentAB"
问题是,code的以下两行需要API级别11和高达:
The problem is that the following two lines of code require API level 11 and up :
<item name="android:windowActionBarOverlay">true</item>
<item name="android:actionBarStyle">@style/BlackBar</item>
但我需要从API级别8个,最多支持。如果我删除这两条线的应用程序运行与黑色半透明操作栏上Android 2.2的罚款。但是,如果我在Android 4.3的运行应用程序的应用与纯白色操作栏启动。 halfblack只是在绘制文件夹中的PNG文件,用70%黑色。
but I need to support from API level 8 and up. If I remove these two lines the app runs fine on Android 2.2 with black translucent action bar. But if I run the app in Android 4.3 the app launches with a solid white action bar. halfblack is just a png file in drawable folder with 70% black color.
推荐答案
找到解决我的问题:
我必须作出独立的styles.xml在res /值-V11支持的Android 3.0及以上。
I have to make separate styles.xml in res/values-v11 to support the same functionality in android 3.0 and up
这篇关于安卓windowActionBarOverlay&放大器;机器人:actionBarStyle需要API级别11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!