android button selector

前端 未结 6 720
梦毁少年i
梦毁少年i 2020-11-22 04:19

This is a button selector such that when normal it appears red, when pressed it appears grey.

I would like to ask how could the code be further directly modified suc

6条回答
  •  南方客
    南方客 (楼主)
    2020-11-22 05:22

    You just need to set selector of button in your layout file.

    and done.

    Edit

    Following is button_effect.xml file in drawable directory

    
    
    
        
        
        
    
    
    

    In this, you can see that there are 3 drawables, you just need to place this button_effect style to your button, as i wrote above. You just need to replace selector_xml_name with button_effect.

提交回复
热议问题