操作栏操作菜单项图标不可见

时间:2014-09-01 11:42:05

标签: android

这是我的菜单

<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.example.citrusz.MainActivity" >

<item
    android:id="@+id/action_offers"
    android:showAsAction="ifRoom"
    android:title="@string/captain_offers"/>
<item
    android:id="@+id/action_events"
    android:showAsAction="ifRoom"
    android:title="@string/events_list"/>
<item
    android:id="@+id/action_user"
    android:icon="@drawable/ic_launcher"
    android:showAsAction="always"
    android:title="@string/action_user"/>

这是我的ActionBar

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <!-- the theme applied to the application or activity -->
    <style name="CustomActionBarTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">

        <!-- Support library compatibility -->
        <item name="actionBarStyle">@style/MyActionBar</item>
        <item name="actionBarTabTextStyle">@style/MyActionBarTabText</item>
        <item name="actionMenuTextColor">@android:color/white</item>
    </style>

    <!-- ActionBar styles -->
    <style name="MyActionBar" parent="@style/Widget.AppCompat.ActionBar">

        <!-- Support library compatibility -->
        <item name="titleTextStyle">@style/MyActionBarTitleText</item>
        <item name="background">@drawable/actionbar_background</item>
    </style>

    <!-- ActionBar title text -->
    <style name="MyActionBarTitleText" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
        <item name="android:textColor">@android:color/white</item>
        <!-- The textColor property is backward compatible with the Support Library -->
    </style>

    <!-- ActionBar tabs text -->
    <style name="MyActionBarTabText" parent="@style/Widget.AppCompat.ActionBar.TabText">
        <item name="android:textColor">@android:color/white</item>
        <!-- The textColor property is backward compatible with the Support Library -->
    </style>

</resources>

我得到以下输出,我需要在ActionBar中看到Logout

enter image description here

1 个答案:

答案 0 :(得分:0)

尝试更改此

 <!-- the theme applied to the application or activity -->
    <style name="CustomActionBarTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">

        <!-- Support library compatibility -->
        <item name="actionBarStyle">@style/MyActionBar</item>
        <item name="actionBarTabTextStyle">@style/MyActionBarTabText</item>
        <item name="actionMenuTextColor">@android:color/white</item>
    </style>

 <!-- the theme applied to the application or activity -->
    <style name="CustomActionBarTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">

        <!-- Support library compatibility -->
        <item name="actionBarStyle">@style/MyActionBar</item>
        <item name="android:actionBarStyle">@style/MyActionBar</item>
        <item name="actionBarTabTextStyle">@style/MyActionBarTabText</item>
        <item name="actionMenuTextColor">@android:color/white</item>
    </style>