Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am trying to grey out my menu item text when it is disabled but am having trouble getting it to work. My menu.xml file is;

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto">
    <group
        android:checkableBehavior="single">
      
        <item
            android:id="@+id/item1"
            android:checked="false"
            android:icon="@drawable/icon_item1"
            android:title="item1"
            app:actionLayout="@layout/item1Counter"/>
       
        <item
            android:id="@+id/about_us"
            android:checked="false"
            android:title="About Us" />
    </group>
</menu>

I disable the menu item above by the following:

var menu1 = menuList.Menu.GetItem(0);
menu1.SetEnabled(false);
//Here is where I want to grey out the icon

Anyone know how I could do that. Also, item1Counter is the item action layout which also has text that will be greyed out. I want everything in item to be greyed out when after I disable it. Anyone know how I can do that?

question from:https://stackoverflow.com/questions/65927946/android-xamarin-grey-out-menu-item-in-c-sharp

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
348 views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...