I think you need to set as background for the clickable view (the layout) a state list drawable , it's a drawable resource for which you can specify different drawables for different states or combinations of states, there's one for selection, one for pression and so on. Also, the state of a layout propagates to all its children.
CLARIFICATIONS - this is the example from the previously linked docs:
res/drawable/button.xml :
(it's the state list drawable)
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/button_pressed" /> <!-- pressed -->
<item android:state_focused="true"
android:drawable="@drawable/button_focused" /> <!-- focused -->
<item android:drawable="@drawable/button_normal" /> <!-- default -->
</selector>
button_pressed
, button_focused
and button_normal
are normal drawables representing the button in those states, probably png's (so pressed could be inset, focused highlighted in orange).
if you set this resource as background to your "linear layout button":
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="@drawable/button">
...
</LinearLayout>
now focusing the layout will automatically set its background image to @drawable/button_focused
, and so on.
of course, all the drawables you use must already be resources in res/drawable/
, together with button.xml
.