0

How to create a button as shown in the picture:

button picture

and also Image name Button should permanently change color on click. Moreover I will be creating this button dynamically from the android file. So it will be good if somebody suggest me in that way instead of xml files way.

Ravi
  • 34,851
  • 21
  • 122
  • 183

1 Answers1

0

Have a look at the ImageButton class. You can easily create this at runtime so long as you have the picture file for your button in your resources. For it to permanently change colour simply create the different coloured version of the file, put that in your resources folder too and run some code on the onClick of the button to change the image of the ImageButton to the different coloured image. Should take no more than a few lines of code.

See: https://developer.android.com/reference/android/widget/ImageButton.html

JamoBox
  • 764
  • 9
  • 23