示例#1
0
        protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs <Button> e)
        {
            base.OnElementChanged(e);

            if (Control != null)
            {
                var newElement = e.NewElement as Panor.Views.BorderButton;

                if (newElement != null)
                {
                    var width   = newElement.BorderWidth;
                    var color   = newElement.BorderColor;
                    var radius  = newElement.BorderRadius;
                    var bgColor = newElement.BackgroundColor;

                    var sd = new Android.Graphics.Drawables.ShapeDrawable();
                    sd.Shape = new BtnShape(
                        bgColor: Android.Graphics.Color.Rgb((int)(bgColor.R * 255), (int)(bgColor.G * 255), (int)(bgColor.B * 255)),
                        borderColor: Android.Graphics.Color.Rgb((int)(color.R * 255), (int)(color.G * 255), (int)(color.B * 255)),
                        borderWidth: Android.App.Application.Context.Resources.DisplayMetrics.Density * (float)width,
                        borderRadius: Android.App.Application.Context.Resources.DisplayMetrics.Density * radius
                        );
                    Control.Background = sd;
                }
            }
        }
        protected BasicShape(Android.Graphics.Drawables.ShapeDrawable shape)
		{
			_shape = shape;
		}
示例#3
0
 protected BasicShape(Android.Graphics.Drawables.ShapeDrawable shape)
 {
     _shape = shape;
 }