Button color change on hover

后端 未结 4 1539
一生所求
一生所求 2021-01-02 11:56

I\'m just a beginner with Android. I want the button to change its color on mouseover.
I don\'t know how to do that in android. Can it be done?

View for a butt

4条回答
  •  佛祖请我去吃肉
    2021-01-02 12:39

    You need to use what's called a selector.

    You can read about them and get a tutorial from this site.

    Keep in mind that there really isn't a concept in Android as "hover" since you can't hover your finger over the display. But you can create selectors for, say, when a button has focus. Normally a button can have three states: Normal, Focused and Pressed.

提交回复
热议问题