Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何将图像设置为动作栏的背景n文本颜色?_Android - Fatal编程技术网

Android 如何将图像设置为动作栏的背景n文本颜色?

Android 如何将图像设置为动作栏的背景n文本颜色?,android,Android,我想将背景图像设置为主活动和所有活动的actionbar,还想改变actionbar文本的颜色 我试过这个代码,但它给了我错误 请帮助我 style.xml <resources> <!-- Base application theme. --> <style name="AppThe" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. -->

我想将背景图像设置为主活动和所有活动的actionbar,还想改变actionbar文本的颜色 我试过这个代码,但它给了我错误 请帮助我

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>`

@可绘制/操作栏\u背景
@样式/操作栏
`
清单代码

<?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">
       <!-- 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>

@样式/操作栏
@样式/操作栏
@可绘制/操作栏\u背景
@可绘制/操作栏\u背景
在这里,您需要同时使用
android:actionBarStyle和actionBarStyle
以及
android:background和background
项。前者适用于本机支持ActionBar的android新版本。后者适用于较旧的android版本

关于错误:

您不能将@android:style/Theme.Holo.Light“与
AppCompatActivity

一起使用什么错误?请分享。最好用完整的信息编辑你的帖子。错误是什么?是运行时吗?