faboptions
faboptions copied to clipboard
Menu icons or menu can't be changed programmatically
First of all, thanks for making this fabulous library!
I am using version 1.2.0 and facing some issues:
- There is no method to change menu icons programmatically.
- When I tried to overcome this issue by using 2 different menus which hold different icons, I was able to change menu, but UI was distorted.
I want to use menus to make an article favorite/ unfavourite, and then according to user input want to change status (icon) of the menu.
Thanks and Regards, Abdul Aziz Ansari
Hey @abduldblogger,
Thanks for the detailed issue. Have you tried to use a selector
instead? You are right I haven't made it possible to change the icons at runtime, but I'm pretty sure you can accomplish this that way ;).
Hi @JoaquimLey,
thanks for replying, sorry I can't get it, how to use "selector", can you show some demo?
You can google that :)
- https://developer.android.com/guide/topics/resources/color-list-resource
ohh, got it, but that is basically used for buttons, that has some states, like focused, pressed, default etc, but how in menu? , I have 2 states only, either favorite or unfavorite, hence I have to used 2 different images (heart image), I hope you understood the issue...
Yes it is possible hehe :)
- https://stackoverflow.com/a/23795983/3374428
@abduldblogger Do you think I can close this issue?
@JoaquimLey , that solution is when you press any menu item and then release, so you will see default and pressed state (different icons for example), for the moment when your thumb is on the menu, but afterward it will come back to normal on removing the touch, what I want to achieve is after pressing the menu item, change the menu icon permanently...I hope I am able to explain you
For better understanding, this will be the change change icon in menu:
Have you tried the solution with the selectors?