How to make button with custom background image show click animation in Android

前端 未结 5 1459
無奈伤痛
無奈伤痛 2020-12-05 16:27

How to make button show it is clicked (by setting it go down/some change) for buttons using custom background image in Android. I do not want to include more images and set

5条回答
  •  时光取名叫无心
    2020-12-05 17:21

    you have to use two images to do this.

    1. button_normal
    2. button_pressed

    then create a xml resource in drawable folder

    
    
    
    
    
    
    
    
    
    

    then, set this file as a background for the imageview. here we are using imageview as button. dont forget to include those two buttons in the drawable folder. thats it.

提交回复
热议问题