Example #1
0
        private void UpdateElevation()
        {
            Elevation    = (float)10;
            TranslationZ = (float)10;

            //We need to reset the StateListAnimator to override the setting of Elevation on touch down and release.
            StateListAnimator = new Android.Animation.StateListAnimator();

            //Set the elevation manually.
            ViewCompat.SetElevation(this, Elevation);
            ViewCompat.SetElevation(RootView, Elevation);

            //If it has a shadow, give it a default Droid looking shadow.
            if (10 > 0)
            {
                //To have shadow show up, we need to clip. However, clipping means that individual corners are lost :(
                OutlineProvider = new RoundedCornerOutlineProvider(Context.ToPixels(Element.CornerRadius), (int)Context.ToPixels(Element.BorderThickness));
                ClipToOutline   = true;
            }
            else
            {
                //To have shadow show up, we need to clip. However, clipping means that individual corners are lost :(
                OutlineProvider = null;
                ClipToOutline   = false;
            }
        }
        private void UpdateElevation()
        {
            if (MaterialFrame.MaterialTheme == MaterialFrame.Theme.Dark || MaterialFrame.MaterialTheme == MaterialFrame.Theme.AcrylicBlur)
            {
                ViewCompat.SetElevation(this, 0);
                return;
            }

            bool isAcrylicTheme = MaterialFrame.MaterialTheme == MaterialFrame.Theme.Acrylic;

            // we need to reset the StateListAnimator to override the setting of Elevation on touch down and release.
            StateListAnimator = new Android.Animation.StateListAnimator();

            // set the elevation manually
            ViewCompat.SetElevation(this, isAcrylicTheme ? MaterialFrame.AcrylicElevation : MaterialFrame.Elevation);
        }