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

问题描述 投票:0回答:1

这是我的菜单

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

我得到以下输出,我需要Logout应该在ActionBar中可见。

android
1个回答
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>
© www.soinside.com 2019 - 2024. All rights reserved.