在 Shell TabBar 中禁用阴影动画

Disable the Shadow Animation in Shell TabBar

如果我在不同的选项卡之间切换,我总是会看到这个看起来像阴影或某物的小点击动画。 我为我的 Shell 使用自定义渲染器,但如何禁用此动画?

Here is a picture of the click animation

我自己找到了解决办法。这是我的代码:

        public void ResetAppearance(BottomNavigationView bottomView)
        {
            
        }
        public void SetAppearance(BottomNavigationView bottomView, IShellAppearanceElement appearance)
        {
            Android.Graphics.Color elevationBGColor = ((Color)Xamarin.Forms.Application.Current.Resources["ElevationBGColor"]).ToAndroid();


            bottomView.LabelVisibilityMode = LabelVisibilityMode.LabelVisibilityUnlabeled;
            bottomView.SetBackgroundColor(elevationBGColor);
            int[][] Tintstates = new int[][]
            {
                new int[] {-Android.Resource.Attribute.StateChecked}, // unchecked
                new int[] { Android.Resource.Attribute.StateChecked}  // pressed
            };

            int[] Tintcolors = new int[]
            {
                Xamarin.Forms.Color.White.ToAndroid(),
                ((Color)Xamarin.Forms.Application.Current.Resources["PrimaryColor"]).ToAndroid()
            };

            ColorStateList TintList = new ColorStateList(Tintstates, Tintcolors)

            bottomView.ItemIconTintList = TintList;
            bottomView.ItemRippleColor = null;
        }

在此代码中,我还为我在导航栏中选择的项目设置了颜色更改,但我搜索的代码是

bottomView.ItemRippleColor = null;