Android how to make View highlight when clicked?

Ok I have finally figured out how to do this…basically it is done using a selector like the color selector linked by style except instead of ‘color’ use a drawable for the states and you can refer to the default list drawable that is used in ListView by this:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
    android:drawable="@android:drawable/list_selector_background" />      
</selector>

and using this xml as the background for my View.

All the public default drawables can be found here: http://developer.android.com/reference/android/R.drawable.html

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)