0

I have an image for a button. Here it is:

enter image description here

My task is to create a selected and unselected state of this image. This image will be my unselected state.

Using the same image, my task is to create a selected button with darker background. Is it possible to darken the image in Java?

NOTE: I have knowledge that I can do this my using an external software and have another image for selected button. However, should my idea be real and was already implemented in Android, it would actually benefit more people. So, upon research, I have not found possible ways to do this. If this is possible, surely I have missed something great.

princepiero
  • 1,287
  • 3
  • 15
  • 28

1 Answers1

0

Ideally you can have a darker image and when clicked in onClick() of onClickListener you can set the alpha setAlpha of this image to 0.5 or you need to implement selectors with two different images/states.

prijupaul
  • 2,076
  • 2
  • 15
  • 17