Reputation: 813
I have a ListView which hast by DEFAULT the normal android ripple effect.When I touch an element it is showing the animation. I didn't add anything in my xml code for this.
But now I want to use a selector for my parent Layout because I want to highlight it when I select it in my contextual action bar. And surprisingly the Ripple effect is gone ...
My XML for Selector is simple as that :
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_activated="true" android:drawable="@color/listview_highlight"/>
<item android:drawable="@color/listview_normal" />
</selector>
I found out that you can use
"< ripple >< /ripple > "
But that needs an Api min 21.
I want to set the animation to default like it was in the past.
How can I do this ?
Upvotes: 0
Views: 326
Reputation: 813
Finally I found a solution by doing try / error. I just needed to add
android:drawSelectorOnTop="true"
To my ListView and Voilaa !
Everything is working fine now , hopefully this post can help someone !
Upvotes: 2
Reputation: 4951
You need to create two selectors:
Keep your current selector in the values
folder and add copy the file to values-v21
.
Then you can add <ripple></ripple>
in values-v21
.
Upvotes: 0