コード例 #1
0
        private void SetupShadow(PancakeView pancake)
        {
            // clear previous shadow/elevation
            this.Elevation    = 0;
            this.TranslationZ = 0;

            bool hasShadowOrElevation = pancake.HasShadow || pancake.Elevation > 0;

            // If it has a shadow, give it a default Droid looking shadow.
            if (pancake.HasShadow)
            {
                this.Elevation    = 10;
                this.TranslationZ = 10;
            }

            // However if it has a specified elevation add the desired one
            if (pancake.Elevation > 0)
            {
                this.Elevation    = 0;
                this.TranslationZ = 0;
                ViewCompat.SetElevation(this, Context.ToPixels(pancake.Elevation));
            }

            if (hasShadowOrElevation)
            {
                // To have shadow show up, we need to clip.
                this.OutlineProvider = new RoundedCornerOutlineProvider(pancake, Context.ToPixels);
                this.ClipToOutline   = true;
            }
            else
            {
                this.OutlineProvider = null;
                this.ClipToOutline   = false;
            }
        }
コード例 #2
0
        private void SetupShadow()
        {
            if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
            {
                // clear previous shadow/elevation
                this.Elevation    = 0;
                this.TranslationZ = 0;

                bool hasShadowOrElevation = Element.Shadow != null;

                if (Element.Shadow != null)
                {
                    ViewCompat.SetElevation(this, Context.ToPixels(Element.Shadow.BlurRadius));
                    // Color only exists on Pie and beyond.
                    if (Build.VERSION.SdkInt >= BuildVersionCodes.P)
                    {
                        this.SetOutlineAmbientShadowColor(Element.Shadow.Color.ToAndroid());
                        this.SetOutlineSpotShadowColor(Element.Shadow.Color.ToAndroid());
                    }
                }

                if (hasShadowOrElevation)
                {
                    // To have shadow show up, we need to clip.
                    this.OutlineProvider = new RoundedCornerOutlineProvider(Element, Context.ToPixels);
                    this.ClipToOutline   = true;
                }
                else
                {
                    this.OutlineProvider = null;
                    this.ClipToOutline   = false;
                }
            }
        }
コード例 #3
0
        public void TransformPage(View view, float position)
        {
            try
            {
                if (viewPager == null)
                {
                    viewPager = view.Parent as ViewPager;
                }

                var leftInScreen       = view.Left - viewPager.ScrollX;
                var centerXInViewPager = leftInScreen + view.MeasuredWidth / 2;
                var offsetX            = centerXInViewPager - viewPager.MeasuredWidth / 2;
                var offsetRate         = (float)offsetX * 0.38f / viewPager.MeasuredWidth;
                var scaleFactor        = 1 - Math.Abs(offsetRate);

                if (scaleFactor > 0)
                {
                    view.ScaleX       = scaleFactor;
                    view.ScaleY       = scaleFactor;
                    view.TranslationX = -maxTranslateOffsetX * offsetRate;
                }
                ViewCompat.SetElevation(view, scaleFactor);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
コード例 #4
0
        public CircleImageView(Context context, int color, float radius) : base(context)
        {
            float density       = Context.Resources.DisplayMetrics.Density;
            int   diameter      = (int)(radius * density * 2);
            int   shadowYOffset = (int)(density * Y_OFFSET);
            int   shadowXOffset = (int)(density * X_OFFSET);

            mShadowRadius = (int)(density * SHADOW_RADIUS);

            ShapeDrawable circle;

            if (elevationSupported())
            {
                circle = new ShapeDrawable(new OvalShape());
                ViewCompat.SetElevation(this, SHADOW_ELEVATION * density);
            }
            else
            {
                OvalShape oval = new OvalShadow(this, mShadowRadius, diameter);
                circle = new ShapeDrawable(oval);
                ViewCompat.SetLayerType(this, ViewCompat.LayerTypeSoftware, circle.Paint);
                circle.Paint.SetShadowLayer(mShadowRadius, shadowXOffset, shadowYOffset,
                                            new Color(KEY_SHADOW_COLOR));
                int padding = mShadowRadius;
                // set padding so the inner image sits correctly within the shadow.
                SetPadding(padding, padding, padding, padding);
            }
            circle.Paint.Color = new Color(color);
            SetBackgroundDrawable(circle);
        }
コード例 #5
0
        public override Android.Views.View OnCreateView(Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Bundle savedInstanceState)
        {
            var root = inflater.Inflate(GetLayout(), container, false);

            this.root     = root;
            this.inflater = inflater;

            InitElements(root, inflater);
            if (position < 1 && listAdapter.IsEmpty)
            {
                InitList(root, inflater);
            }

            ViewCompat.SetElevation(root, 50);

            listView.ItemClick += (sender, e) =>
            {
                var intent = new Intent(container.Context, typeof(ViewSessionActivity));
                if (isWorkshop)
                {
                    intent = new Intent(container.Context, typeof(ViewWorkshopActivity));
                }

                intent.PutExtra("Id", (int)e.Id);
                intent.PutExtra("IsBooking", true);
                StartActivity(intent);
            };
            return(root);
        }
コード例 #6
0
        private void SetupShadow(PancakeView pancake)
        {
            bool hasShadowOrElevation = pancake.HasShadow || pancake.Elevation > 0;

            // If it has a shadow, give it a default Droid looking shadow.
            if (pancake.HasShadow)
            {
                this.Elevation    = 10;
                this.TranslationZ = 10;
            }

            // However if it has a specified elevation add the desired one
            if (pancake.Elevation > 0)
            {
                this.Elevation    = 0;
                this.TranslationZ = 0;
                ViewCompat.SetElevation(this, Context.ToPixels(pancake.Elevation));
            }

            if (hasShadowOrElevation)
            {
                // To have shadow show up, we need to clip. However, clipping means that individual corners are lost :(
                this.OutlineProvider = new RoundedCornerOutlineProvider(Context.ToPixels(pancake.CornerRadius.TopLeft), (int)Context.ToPixels(pancake.BorderThickness));
                this.ClipToOutline   = true;
            }
        }
コード例 #7
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;
            }
        }
コード例 #8
0
        public CircleImageView(Context context, int color, float radius) : base(context)
        {
            var density       = Context.Resources.DisplayMetrics.Density;
            var diameter      = (int)(radius * density * 2);
            var shadowYOffset = (int)(density * YOffset);
            var shadowXOffset = (int)(density * XOffset);

            _shadowRadius = (int)(density * ShadowRadius);

            ShapeDrawable circle;

            if (ElevationSupported())
            {
                circle = new ShapeDrawable(new OvalShape());
                ViewCompat.SetElevation(this, ShadowElevation * density);
            }
            else
            {
                OvalShape oval = new OvalShadow(this, _shadowRadius, diameter);
                circle = new ShapeDrawable(oval);
#pragma warning disable 618
                ViewCompat.SetLayerType(this, ViewCompat.LayerTypeSoftware, circle.Paint);
#pragma warning restore 618
                circle.Paint.SetShadowLayer(_shadowRadius, shadowXOffset, shadowYOffset,
                                            new Color(KeyShadowColor));
                var padding = _shadowRadius;
                SetPadding(padding, padding, padding, padding);
            }
            circle.Paint.Color = new Color(color);
#pragma warning disable 618
            SetBackgroundDrawable(circle);
#pragma warning restore 618
        }
コード例 #9
0
ファイル: BottomBar.cs プロジェクト: morhung/demo2018
        private void InitializeViews()
        {
            _isTabletMode = !_ignoreTabletLayout && _context.Resources.GetBoolean(Resource.Boolean.bb_bottom_bar_is_tablet_mode);

            ViewCompat.SetElevation(this, MiscUtils.DpToPixel(_context, 8));

            View rootView = Inflate(_context,
                                    _isTabletMode ? Resource.Layout.bb_bottom_bar_item_container_tablet : Resource.Layout.bb_bottom_bar_item_container,
                                    this);

            _tabletRightBorder = rootView.FindViewById(Resource.Id.bb_tablet_right_border);

            UserContainer = (ViewGroup)rootView.FindViewById(Resource.Id.bb_user_content_container);
            _shadowView   = rootView.FindViewById(Resource.Id.bb_bottom_bar_shadow);

            OuterContainer = (ViewGroup)rootView.FindViewById(Resource.Id.bb_bottom_bar_outer_container);
            ItemContainer  = (ViewGroup)rootView.FindViewById(Resource.Id.bb_bottom_bar_item_container);

            _backgroundView    = rootView.FindViewById(Resource.Id.bb_bottom_bar_background_view);
            _backgroundOverlay = rootView.FindViewById(Resource.Id.bb_bottom_bar_background_overlay);

            if (PendingUserContentView != null)
            {
                var param = PendingUserContentView.LayoutParameters;

                if (param == null)
                {
                    param = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
                }

                UserContainer.AddView(PendingUserContentView, 0, param);
                PendingUserContentView = null;
            }
        }
コード例 #10
0
        /// <summary>
        /// If progress view has previously been created, layoutName=null can be used to just update the text
        /// </summary>
        public static void ShowLoading(string message, string layoutName, string template, Activity activity, View view, ref View _progress)
        {
            ViewGroup root;

            if (view == null)
            {
                root = activity.FindViewById <RelativeLayout>(Resource.Id.root);
            }
            else
            {
                root = view.FindViewById <RelativeLayout>(Resource.Id.rootFragment);
            }

            if (root != null)
            {
                if (_progress == null)
                {
                    var layoutId = GetLayoutId(layoutName, activity);

                    _progress = View.Inflate(activity, layoutId, null);
                    _progress.LayoutParameters = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
                    _progress.SetOnTouchListener(new BlockTouchListener());
                    ViewCompat.SetElevation(_progress, 10);

                    SetMessage(message, template, activity, _progress);

                    root.AddView(_progress);
                }
                else
                {
                    SetMessage(message, template, activity, _progress);
                }
            }
        }
        private void UpdateMaterialShadow()
        {
            var materialButton = (MaterialButton)Element;

            ViewCompat.SetElevation(this, materialButton.Elevation);
            ViewCompat.SetElevation(Control, materialButton.Elevation);
            UpdateLayout();
        }
コード例 #12
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View root;

            if (position == 0)
            {
                root      = inflater.Inflate(Resource.Layout.CameraFragment, container, false);
                context   = root.Context;
                imageView = root.FindViewById <ImageView>(Resource.Id.imageView);
                Intent intent = new Intent(MediaStore.ActionImageCapture);
                StartActivityForResult(intent, 0);
            }
            else if (position == 1)
            {
                root    = inflater.Inflate(Resource.Layout.ProductList, container, false);
                lv      = root.FindViewById <ListView>(Resource.Id.productsList);
                context = root.Context;
                ProductsViewModel pvm = new ProductsViewModel();
                adapter = new ProductAdapter(context, pvm.Products);

                lv.Adapter = adapter;
            }
            else
            {
                root       = inflater.Inflate(Resource.Layout.RestTest, container, false);
                readJson   = root.FindViewById <Button>(Resource.Id.readJson);
                sendData   = root.FindViewById <Button>(Resource.Id.sendData);
                resultView = root.FindViewById <TextView>(Resource.Id.resultView);

                readJson.Click += async delegate
                {
                    using (var client = new HttpClient())
                    {
                        // send a GET request
                        var uri = "http://192.168.0.110/SmartPrice/api/Product/GetProducts";
                        //var result = await client.GetAsync(uri);

                        var response = await client.GetAsync(uri).ConfigureAwait(false);

                        response.EnsureSuccessStatusCode();
                        var responseContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

                        var products = JsonConvert.DeserializeObject <List <Product> >(responseContent);


                        //handling the answer
                        //var posts = JsonConvert.DeserializeObject<List<Product>>(result.ToString());

                        ////// generate the output
                        //var post = products.First();
                        //resultView.Text = "First post:\n\n" + post.ToString();
                    }
                };
            }

            ViewCompat.SetElevation(root, 50);
            return(root);
        }
コード例 #13
0
        public override Android.Views.View OnCreateView(Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Bundle savedInstanceState)
        {
            var root = inflater.Inflate(Resource.Layout.fragment_card, container, false);
            var text = root.FindViewById <TextView> (Resource.Id.textView);

            text.Text = "Card: " + position;
            ViewCompat.SetElevation(root, 50);
            return(root);
        }
コード例 #14
0
        private void UpdateElevation()
        {
            var customFrame = (CustomFrame)Element;

            Control.StateListAnimator = new Android.Animation.StateListAnimator();

            ViewCompat.SetElevation(this, customFrame.Elevation);
            ViewCompat.SetElevation(Control, customFrame.Elevation);
        }
コード例 #15
0
        private void UpdateElevation()
        {
            // we need to reset the StateListAnimator to override the setting of Elevation on touch down and release.
            Control.StateListAnimator = new Android.Animation.StateListAnimator();

            // set the elevation manually
            ViewCompat.SetElevation(this, MaterialFrame.Elevation);
            ViewCompat.SetElevation(Control, MaterialFrame.Elevation);
        }
コード例 #16
0
        private void UpdateShadow()
        {
            // we need to reset the StateListAnimator to override the setting of Elevation on touch down and release.
            Control.StateListAnimator = new global::Android.Animation.StateListAnimator();

            // set the elevation manually
            ViewCompat.SetElevation(this, 4.0f);
            ViewCompat.SetElevation(Control, 4.0f);
        }
コード例 #17
0
        private void UpdateElevation()
        {
            var materialFrame = (MidgeFrame)Element;

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

            ViewCompat.SetElevation(this, materialFrame.Elevation);
            ViewCompat.SetElevation(Control, materialFrame.Elevation);
        }
コード例 #18
0
ファイル: Functions.cs プロジェクト: TeckFreak/UniHub
 /// <summary>
 /// Apply elevation on the views for API 21+ devices.
 /// </summary>
 /// <param name="elevation">Size of the elevation.</param>
 /// <param name="views">Views on which the elevation is to be applied.</param>
 public static void SetElevation(float elevation, params View[] views)
 {
     foreach (View view in views)
     {
         if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
         {
             ViewCompat.SetElevation(view, elevation);
         }
     }
 }
コード例 #19
0
 /// <param name="e"></param>
 protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     base.OnElementPropertyChanged(sender, e);
     if (e.PropertyName == "Elevation")
     {
         var materialButton = (MaterialButton)Element;
         ViewCompat.SetElevation(this, materialButton.Elevation);
         ViewCompat.SetElevation(Control, materialButton.Elevation);
         UpdateLayout();
     }
 }
コード例 #20
0
        private void SetupShadow(PancakeView pancake)
        {
            if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
            {
                // clear previous shadow/elevation
                this.Elevation    = 0;
                this.TranslationZ = 0;

                bool hasShadowOrElevation = pancake.Shadow != null || pancake.HasShadow || pancake.Elevation > 0;

                if (pancake.Shadow != null)
                {
                    ViewCompat.SetElevation(this, Context.ToPixels(pancake.Shadow.BlurRadius));

#if MONOANDROID90
                    // Color only exists on Pie and beyond.
                    if (Build.VERSION.SdkInt >= BuildVersionCodes.P)
                    {
                        this.SetOutlineAmbientShadowColor(pancake.Shadow.Color.ToAndroid());
                        this.SetOutlineSpotShadowColor(pancake.Shadow.Color.ToAndroid());
                    }
#endif
                }
                else
                {
                    // If it has a shadow, give it a default Droid looking shadow.
                    if (pancake.HasShadow)
                    {
                        this.Elevation    = 10;
                        this.TranslationZ = 10;
                    }

                    // However if it has a specified elevation add the desired one
                    if (pancake.Elevation > 0)
                    {
                        this.Elevation    = 0;
                        this.TranslationZ = 0;
                        ViewCompat.SetElevation(this, Context.ToPixels(pancake.Elevation));
                    }
                }

                if (hasShadowOrElevation)
                {
                    // To have shadow show up, we need to clip.
                    this.OutlineProvider = new RoundedCornerOutlineProvider(pancake, Context.ToPixels);
                    this.ClipToOutline   = true;
                }
                else
                {
                    this.OutlineProvider = null;
                    this.ClipToOutline   = false;
                }
            }
        }
コード例 #21
0
 private void SetHasShadow()
 {
     if (this.Element.HasShadow)
     {
         ViewCompat.SetElevation(this.Control, 20);
     }
     else
     {
         ViewCompat.SetElevation(this.Control, 0);
     }
 }
コード例 #22
0
        public override void ClearView(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder)
        {
            base.ClearView(recyclerView, viewHolder);

            if (viewHolder.ItemView is MaterialCardView card)
            {
                card.Dragged = false;
            }
            else
            {
                ViewCompat.SetElevation(viewHolder.ItemView, 0f);
            }
        }
コード例 #23
0
        protected override void OnLayout(bool changed, int left, int top, int right, int bottom)
        {
            base.OnLayout(changed, left, top, right, bottom);
            float density = Context.Resources.DisplayMetrics.Density;

            mDiameter = Math.Min(MeasuredWidth, MeasuredHeight);
            if (mDiameter <= 0)
            {
                mDiameter = (int)density * DEFAULT_CIRCLE_DIAMETER;
            }
            if (Background == null && mCircleBackgroundEnabled)
            {
                int shadowYOffset = (int)(density * Y_OFFSET);
                int shadowXOffset = (int)(density * X_OFFSET);
                mShadowRadius = (int)(density * SHADOW_RADIUS);

                if (ElevationSupported())
                {
                    mBgCircle = new ShapeDrawable(new OvalShape());
                    ViewCompat.SetElevation(this, SHADOW_ELEVATION * density);
                }
                else
                {
                    OvalShape oval = new OvalShadow(mShadowRadius, mDiameter, this);
                    mBgCircle = new ShapeDrawable(oval);
                    ViewCompat.SetLayerType(this, ViewCompat.LayerTypeSoftware, mBgCircle.Paint);
                    mBgCircle.Paint.SetShadowLayer(mShadowRadius, shadowXOffset, shadowYOffset,
                                                   KEY_SHADOW_COLOR);
                    int padding = (int)mShadowRadius;
                    SetPadding(padding, padding, padding, padding);
                }
                mBgCircle.Paint.Color = mBackGroundColor;
                SetBackgroundDrawable(mBgCircle);
            }
            mProgressDrawable.SetBackgrounColor(mBackGroundColor);
            mProgressDrawable.SetColorSchemeColors(mColors);
            mProgressDrawable.SetSizeParameters(mDiameter, mDiameter,
                                                mInnerRadius <= 0 ? (mDiameter - mProgressStokeWidth * 2) / 4 : mInnerRadius,
                                                mProgressStokeWidth,
                                                mArrowWidth < 0 ? mProgressStokeWidth * 5 : mArrowWidth,
                                                mArrowHeight < 0 ? mProgressStokeWidth * 2 : mArrowHeight);
            if (IsShowArrow())
            {
                mProgressDrawable.SetArrowScale(1f);
                mProgressDrawable.ShowArrow(true);
            }
            base.SetImageDrawable(null);
            base.SetImageDrawable(mProgressDrawable);
            mProgressDrawable.SetAlpha(255);
            mProgressDrawable.Start();
        }
コード例 #24
0
ファイル: Marker.cs プロジェクト: llenroc/DiscreteSeekBar
        public Marker(Context context, IAttributeSet attrs, int defStyleAttr, String maxValue, int thumbSize, int separation)
            : base(context, attrs, defStyleAttr)
        {
            Visibility = ViewStates.Visible;

            DisplayMetrics displayMetrics = context.Resources.DisplayMetrics;
            TypedArray     a = context.ObtainStyledAttributes(attrs, Resource.Styleable.DiscreteSeekBar,
                                                              Resource.Attribute.discreteSeekBarStyle, Resource.Style.Widget_DiscreteSeekBar);

            int padding          = (int)(PADDING_DP * displayMetrics.Density) * 2;
            int textAppearanceId = a.GetResourceId(Resource.Styleable.DiscreteSeekBar_dsb_indicatorTextAppearance,
                                                   Resource.Style.Widget_DiscreteIndicatorTextAppearance);

            mNumber = new TextView(context);
            //Add some padding to this textView so the bubble has some space to breath
            mNumber.SetPadding(padding, 0, padding, 0);
            mNumber.SetTextAppearance(context, textAppearanceId);
            mNumber.Gravity = GravityFlags.Center;
            mNumber.Text    = maxValue;
            mNumber.SetMaxLines(1);
            mNumber.SetSingleLine(true);
            SeekBarCompat.SetTextDirection(mNumber, (int)TextDirectionLocale);
            mNumber.Visibility = ViewStates.Invisible;

            //add some padding for the elevation shadow not to be clipped
            //I'm sure there are better ways of doing this...
            SetPadding(padding, padding, padding, padding);

            ResetSizes(maxValue);

            mSeparation = separation;
            ColorStateList color = a.GetColorStateList(Resource.Styleable.DiscreteSeekBar_dsb_indicatorColor);

            mMarkerDrawable = new MarkerDrawable(color, thumbSize);
            mMarkerDrawable.SetCallback(this);
            mMarkerDrawable.SetMarkerListener(this);
            mMarkerDrawable.SetExternalOffset(padding);

            //Elevation for anroid 5+
            float elevation = a.GetDimension(Resource.Styleable.DiscreteSeekBar_dsb_indicatorElevation, ELEVATION_DP * displayMetrics.Density);

            ViewCompat.SetElevation(this, elevation);
            if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
            {
                SeekBarCompat.SetOutlineProvider(this, mMarkerDrawable);
            }
            a.Recycle();
        }
コード例 #25
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var root = inflater.Inflate(Resource.Layout.login, container, false);

            loginBtn         = root.FindViewById <Button>(Resource.Id.auth_btn);
            loginTxt         = root.FindViewById <EditText>(Resource.Id.input_login);
            passwordTxt      = root.FindViewById <EditText>(Resource.Id.input_password);
            errorTxt         = root.FindViewById <TextView>(Resource.Id.errorText);
            restore_pass_btn = root.FindViewById <TextView>(Resource.Id.errorText);

            restore_pass_btn.Click += RestorePassword;
            loginBtn.Click         += Login;

            ViewCompat.SetElevation(root, 50);
            return(root);
        }
        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);
        }
コード例 #27
0
        protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.Button> e)
        {
            base.OnElementChanged(e);
            if (e.NewElement == null)
            {
                return;
            }

            var materialButton = (MaterialButton)Element;

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

            // set the elevation manually
            ViewCompat.SetElevation(this, materialButton.Elevation);
            ViewCompat.SetElevation(Control, materialButton.Elevation);
        }
コード例 #28
0
        protected override void OnElementChanged(ElementChangedEventArgs <Frame> e)
        {
            base.OnElementChanged(e);
            if (e.NewElement != null)
            {
                ViewGroup.SetBackgroundResource(Resource.Drawable.FrameShadow);

                if (Build.VERSION.SdkInt < BuildVersionCodes.Lollipop)
                {
                    ViewCompat.SetElevation(ViewGroup, 6.0f);
                }
                else
                {
                    Elevation = 6;
                }
            }
        }
コード例 #29
0
        private void UpdateElevation()
        {
            // we need to reset the StateListAnimator to override the setting of Elevation on touch down and release.
            Control.StateListAnimator = new Android.Animation.StateListAnimator();

            //set the elevation manually
            if (IsSelected)
            {
                ViewCompat.SetElevation(this, 30);
                ViewCompat.SetElevation(Control, 30);
            }
            else
            {
                ViewCompat.SetElevation(this, 10);
                ViewCompat.SetElevation(Control, 10);
            }
        }
コード例 #30
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var root = inflater.Inflate(Resource.Layout.registration, container, false);

            ViewCompat.SetElevation(root, 50);

            regBtn             = root.FindViewById <Button>(Resource.Id.reg_btn);
            loginTxt           = root.FindViewById <EditText>(Resource.Id.reg_login);
            emailTxt           = root.FindViewById <EditText>(Resource.Id.reg_mail);
            passwordTxt        = root.FindViewById <EditText>(Resource.Id.reg_pass);
            confirmPasswordTxt = root.FindViewById <EditText>(Resource.Id.reg_conf_pass);
            regErrorMess       = root.FindViewById <TextView>(Resource.Id.regErrorView);

            regBtn.Click += addNewUser;

            return(root);
        }