I have not found any answer for my problem, so I need your help ... I have an LinearLayout which I want to be clickable in order to lunch another activity. So I implement an onClickListener to it. I created an selector for this LinearLayout in order that when someone click on it, the background change.
I just don't understand that :
- If my LinearLayout doesn't have android:clickable="true" in the xml, I'm able to click on it and get what I want but the selector doesn't work.
- If I remove this line, it is the opposite .. the selector work but not the onClick event.
So, can anyone can explain me why ? Just in case, here is my the content of my selector file :
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/btn_restaurants_background_state_pressed" android:state_pressed="true"></item>
<item android:drawable="@drawable/btn_restaurants_background_state_pressed" android:state_focused="true"></item>
<item android:drawable="@drawable/btn_restaurants_background_state_pressed" android:state_selected="true"></item>
<item android:drawable="@drawable/btn_restaurants_background_state_normal"></item>
</selector>
Thanks you in advance