We can set the View. onClickListener listener for LinearLayout and all controls inherited from the View, such as LInearLayout.
However, we found that LinearLayout can execute the listening method body, but it does not have the effect of clicking.
The so-called click effect is that when we click the control with the mouse, we can highlight or move it to give the user an operation feedback.
How to implement the above effect for LinearLayout is to configure the following attributes for LinearLayout
style="?android:attr/actionButtonStyle" style="?android:attr/actionButtonStyle"
Then our buttons have the style effect of the Button. Click and other operations are the same as Button operations.
In addition, we can configure a file, such as the image effect when you click in the file configuration, and the image effect when you press the file, for example:
?<selector xmlns:android="http://schemas.android.com/apk/res/android" |~ android:exitFadeDuration="@android:integer/config_mediumAnimTime"> |~ |~ <!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of |~ pressed state. --> |~ <item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/ |~ list_selector_disabled_holo_dark" /> |~ <item android:state_focused="true" android:state_enabled="false" android:drawable="@drawable/ |~ list_selector_disabled_holo_dark" /> |~ <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/ |~ list_selector_background_transition_holo_dark" /> |~ <item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/ |~ list_selector_background_transition_holo_dark" /> |~ <item android:state_focused="true" android:drawable="@drawable/ |~ list_focused_holo" /> |~ <item android:drawable="@color/transparent" /|~ > |~ </selector> <selector xmlns:android="http://schemas.android.com/apk/res/android" |~ android:exitFadeDuration="@android:integer/config_mediumAnimTime"> |~ |~ <!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of |~ pressed state. --> |~ <item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/ |~ list_selector_disabled_holo_dark" /> |~ <item android:state_focused="true" android:state_enabled="false" android:drawable="@drawable/ |~ list_selector_disabled_holo_dark" /> |~ <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/ |~ list_selector_background_transition_holo_dark" /> |~ <item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/ |~ list_selector_background_transition_holo_dark" /> |~ <item android:state_focused="true" android:drawable="@drawable/ |~ list_focused_holo" /> |~ <item android:drawable="@color/transparent" /|~ > |~ </selector>