I am working on an android application that requires me to give an option of marking objects as favorite. I am planning of creating a clickable star on the right corner of the toolbar. So, when I click on that star it should become yellow and should be dull color star otherwise. Is there a way I can do that ?
Asked
Active
Viewed 407 times
1 Answers
0
You can create two images. One of the star without the yellow background. set an on click listener for it. and on click you can change the image to the one which has the yellow background. hope this helps

AxeManTOBO
- 487
- 1
- 4
- 17
-
thanks for your suggestion. But how to create an image view on toolbar ? – Puneet Chugh Mar 26 '16 at 19:09
-
here is on adding the image views http://stackoverflow.com/questions/30063426/best-way-to-create-a-bottom-toolbar-in-android/30063604#30063604 – AxeManTOBO Mar 26 '16 at 19:11
-
and to add listeners for the image here is the link http://stackoverflow.com/questions/30276281/its-possible-to-add-imageview-in-a-toolbar – AxeManTOBO Mar 26 '16 at 19:11
-
If i have answered your question could you accept my answer as correct? – AxeManTOBO Mar 26 '16 at 19:12
-
Sure. I have accepted your answer. That was pretty quick and useful !! Thanks a ton @AxeManTOBO – Puneet Chugh Mar 26 '16 at 19:18