我有一个带有ListView的Xamarin.Forms应用程序 . 当一个listItem被按下时,在Android上有一个连锁反应 . 要求抑制这种波动 .

我在Android项目中尝试了一种风格:

<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>

没有运气 - 风格不会被捡起来 . 我尝试了一个自定义的ViewCell渲染器:

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);
            }
        }
    }

那也行不通 . 涟漪效应仍然存在,只有当纹波结束时,所选项目才会获得新的背景颜色 .

这个问题涉及Xamarin.Forms,而不是Xamarin.Android和Java .