I have a Xamarin.Forms app with a ListView. When a listItem in pressed, on Android there is a ripple effect. It is a requirement to suppress that ripple.
I've tried it with a style in the Android project:
<style name="MainTheme" parent="MainTheme.Base">
<item name="android:listViewStyle">@style/ListViewStyle.Light</item>
</style>
<style name="ListViewStyle.Light" parent="android:style/Widget.ListView">
<item name="android:listSelector">@drawable/actionbar_background_green</item>
</style>
No luck - the style does not get picked up. I tried a custom ViewCell renderer:
protected override void OnCellPropertyChanged(object sender, PropertyChangedEventArgs args)
{
base.OnCellPropertyChanged(sender, args);
if (args.PropertyName == "IsSelected")
{
_selected = !_selected;
if (_selected)
{
_cellCore.SetBackgroundColor(Color.Transparent);
}
else
{
_cellCore.SetBackground(_unselectedBackground);
}
}
}
That didn't work either. The ripple effect is still there and only when the ripple is over, the selected item picks up the color new background color.
The question concerns Xamarin.Forms, not Xamarin.Android nor Java.