Button Background Selector

前端 未结 2 1907
广开言路
广开言路 2021-01-18 02:40

I try to switch the background of Buttons if they are pressed. I build a Selector like the answer suggested here: Standard Android Button with a different color

Fin

2条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-18 03:30

    put this at the end

    item android:drawable="@color/red"

    i mean as the third option, it will work. android checks the xml conditions from the start, the first tag doesn't have any condition, so it will always pick red, so you have put conditions first and then the default one.

提交回复
热议问题