So after a long, long time we figured it out, you can accomplish it with a custom renderer. Here is how,
First, create a file called no_selector.xml and place it in the Resources/layouts folder (the packaging properties must be set to AndroidResource).
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:drawable="@android:color/transparent"/>
</selector>
After that create a custom renderer for the ListView component,
[assembly: ExportRenderer (typeof(ListView), typeof(NoRippleListViewRenderer))]
namespace Your.Own.Namespace
{
public class NoRippleListViewRenderer : ListViewRenderer
{
protected override void OnElementChanged (ElementChangedEventArgs<ListView> e)
{
base.OnElementChanged (e);
Control.SetSelector (Resource.Layout.no_selector);
}
}
}
If the no_selector
file can't be found rebuild your project!
Be aware of the fact that this removes the ripple for all the ListViews in your application. If you only want it to target a couple you can change the first type on the ExportRenderer attribute (this does require you to make a separate class that extends ListView).
https://gist.github.com/awatertrevi/d83787dbbf3de6ef0e0a344169d3c2fa
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…