我想把背景图像设置为主要活动和所有活动的操作栏,还想更改操作栏文本的文本颜色我试过这个代码,但它给了我错误plz帮我
style.xml
<resources>
<!-- Base application theme. -->
<style name="AppThe" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
<style name="ActionBar" parent="@android:style/Widget.Holo.ActionBar">
<item name="android:background">@drawable/actionbar_background</item>
</style>
<style name="MyTheme" parent="@android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">@style/ActionBar</item>
</style>
</resources>`
舱单代码
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.hp.navigationd"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="23" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="OLXA"
android:theme="@style/AppThe" >
<activity
android:name="com.example.hp.navigationd.MainActivity"
android:label="OLXA" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.hp.navigationd.post_ad"
android:label="@string/Ad_Details"
android:parentActivityName="com.example.hp.navigationd.MainActivity" />
<activity android:name="com.example.hp.navigationd.My_account" />
<activity android:name="com.example.hp.navigationd.My_fav" />
<activity android:name="com.example.hp.navigationd.My_ads" />
<activity android:name="com.example.hp.navigationd.My_chats" />
<activity android:name="com.example.hp.navigationd.Rules" />
<activity android:name="com.example.hp.navigationd.Help" />
<activity android:name="com.example.hp.navigationd.About_us" />
</application>
</manifest>
试试这个,
使用说明,
<style name="AppThe" parent="Theme.AppCompat.Light.DarkActionBar">
使用这个,
<style name="AppThe" parent="@android:style/Theme.Holo.Light.DarkActionBar">
查看以下样式。
<style name="AppThe" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="android:actionBarStyle">@style/ActionBar</item>
<item name="actionBarStyle">@style/ActionBar</item>
</style>
<style name="ActionBar" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background">@drawable/actionbar_background</item>
<item name="background">@drawable/actionbar_background</item>
</style>
在这里,您需要同时使用android:actionBarStyle and actionBarStyle
和android:background and background
项目。前者适用于本机支持ActionBar的新版android。后者适用于较旧的android版本。
关于错误:
不能将"@android:style/Theme.Holo.Light"
与AppCompatActivity
一起使用