Pressed android button state

前端 未结 1 1938
耶瑟儿~
耶瑟儿~ 2020-12-06 18:43

I\'ve been following a tutorial that explains how to use background for a button with different states but it doesn\'t seem to work :S

Here is my code :

<         


        
1条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-06 19:14

    Is the Button the only thing you have displayed in your Activity? If so, then it will be focused (triggering the third item in your selector) when the window loads, and you won't be able to navigate away from it. If you want to change only when pressed, delete that third line. While you're at it, delete the first line, as the button will never be pressed when the window isn't focused.

    In fact, I suggest this code:

    
    
        
        
    
    

    0 讨论(0)
提交回复
热议问题