Standard ListView
selector in android L developer preview uses colorControlHighlight
for the ripple effect on touch and has a transparent background in unfocused state.
I would like to define a ListView
item that has a colored background and still shows the ripple effect on touch with the same highlight color. Now, if I define the following drawable:
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:colorControlHighlight">
<item android:drawable="@color/my_background_color"/>
</ripple>
it works, but the ripple starts in the middle of the ListView
item, regardless of the touch position. If I use the same background outside of the ListView
, e.g. for a LinearLayout
, it works like expected (the ripple starts on the touch position).
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…