I had to answer this question, although I'm not sure about it, but this is what I think:
I'll start with Q2:
state_window_focused corresponds to the default behavior (the "window" is visible but not focused), and I think it used only to specify the default value ( TRANSPARENT ).
About Q1:
DRAWABLE2 will be displayed both in both cases and under the same conditions - focused and not pressed, because:
The first case:
<item android:drawable="<DRAWABLE_2>" android:state_focused="true"/>
Second case:
`<item android:drawable="<DRAWABLE_2>" android:state_focused="true" android:state_pressed="false"/>`
We have D2 when it is focused, but in your case also not pressed.
DRAWABLE1 will only be displayed when pressed in each case. The difference is that in the first case, two additional states are also given by android:state_focused="true/false" , which makes no sense, so the two lines in case 1 can be compressed to one (exactly the one you have):
<item android:drawable="<DRAWABLE_1>" android:state_pressed="true"/>
So, to summarize:
Case 1 - you have:
<selector> <item android:drawable="<TRANSPARENT>" android:state_window_focused="false"/> <item android:drawable="<DRAWABLE_1>" android:state_focused="true" android:state_pressed="true"/> <item android:drawable="<DRAWABLE_1>" android:state_focused="false" android:state_pressed="true"/> <item android:drawable="<DRAWABLE_2>" android:state_focused="true"/> </selector>
Which is equivalent:
<selector> <item android:drawable="<TRANSPARENT>" android:state_window_focused="false"/> <item android:drawable="<DRAWABLE_1>" android:state_pressed="true"/> <item android:drawable="<DRAWABLE_2>" android:state_focused="true"/> </selector>
And your case (case 2), for comparison:
<selector> <item android:drawable="<DRAWABLE_2>" android:state_pressed="false" android:state_focused="true"/> <item android:drawable="<DRAWABLE_1>" android:state_pressed="true"/> <item android:drawable="<TRANSPARENT>" /> </selector>
The only difference that I see so far is that in the first case, DRAWABLE2 will only be displayed when focusing (whether pressed or not), but in your case it should also be unpressed and that the only condition that is different .