Is it possible to grey out (not just disable) a MenuItem in Android?

后端 未结 8 1150
旧时难觅i
旧时难觅i 2020-12-23 13:35

There\'s a question for the same functionality on Blackberry, and a few different threads referred to this bug (which has since been closed without resolution as far as I ca

8条回答
  •  孤城傲影
    2020-12-23 14:10

    I was having difficulty with this on modern android with MaterialComponents theme. My problem was I had set @color/blue in styles.xml and this overrides the text color whether the item is enabled or disabled. The solution is to set a Color state list and not a color directly.

    My styles attribute now looks like:

    @color/menu_color_selector

提交回复
热议问题