【发布时间】:2014-01-28 07:04:44
【问题描述】:
我正在通过创建自己的样式并通过清单应用来更改 Android ActionBar 颜色。但是当我在模拟器上运行时,ActionBar 以及屏幕本身正在改变颜色。看图:
我试图搜索这个问题的答案,但没有得到解决。这是清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.actionbartestapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/MyActionBar" >
<activity
android:name="com.example.actionbartestapp.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
这是 Styles.xml 文件:
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<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>
<style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">@color/SmugeBlue</item>
</style>
</resources>
【问题讨论】:
-
使用
- @drawable/actionstyle
在 "actionstyle" 里面放上你需要的纯色
标签: android android-actionbar android-manifest android-styles