private void UpdateCornerRadius(RoundedBox box) { Layer.CornerRadius = (float)box.CornerRadius; }
public SpinnerView() { // Init this.Opacity = 0; // Create Controls var relativeLayout = new RelativeLayout() { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; _roundedBox = new RoundedBox() { BackgroundColor = Color.Black, CornerRadius = 10, Opacity = 1 }; _spinnerViewProgressBar = new ProgressBar(); _spinnerViewLabel = new Label() { TextColor = Color.White, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)), HorizontalTextAlignment = TextAlignment.Center }; _spinnerViewActivityIndicator = new ActivityIndicator() { Color = Color.White }; // Rounded Box relativeLayout.Children.AddInOrigo(_roundedBox, 120, 100); // Progress Bar //_spinnerViewProgressBar.IsVisible = this.ShowProgress; _spinnerViewProgressBar.Opacity = this.ShowProgress ? 1 : 0; _spinnerViewProgressBar.Progress = this.Progress; relativeLayout.Children.Add(_spinnerViewProgressBar, xConstraint: Constraint.RelativeToView(_roundedBox, (RelativeLayout arg1, View arg2) => { return(arg2.Bounds.Left + 10); }), yConstraint: Constraint.RelativeToView(_roundedBox, (RelativeLayout arg1, View arg2) => { return(arg2.Bounds.Bottom - 15); }), widthConstraint: Constraint.RelativeToView(_roundedBox, (RelativeLayout arg1, View arg2) => { return(arg2.Bounds.Width - 20); }), heightConstraint: Constraint.Constant(10)); // Label _spinnerViewLabel.Text = this.Message; relativeLayout.Children.Add(_spinnerViewLabel, xConstraint: Constraint.RelativeToView(_roundedBox, (RelativeLayout arg1, View arg2) => { return(arg2.Bounds.Left + 10); }), yConstraint: Constraint.RelativeToView(_roundedBox, (RelativeLayout arg1, View arg2) => { return(arg2.Bounds.Top + 5); }), widthConstraint: Constraint.RelativeToView(_roundedBox, (RelativeLayout arg1, View arg2) => { return(arg2.Bounds.Width - 20); })); // Activity Indicator relativeLayout.Children.AddInOrigo(_spinnerViewActivityIndicator, 50, 50); // Return this.Content = relativeLayout; }
public SpinnerView() { // Init this.Opacity = 0; // Create Controls var relativeLayout = new RelativeLayout() { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; _roundedBox = new RoundedBox() { BackgroundColor = Color.Black, CornerRadius = 10, Opacity = 1 }; _spinnerViewProgressBar = new ProgressBar(); _spinnerViewLabel = new Label() { TextColor = Color.White, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)), HorizontalTextAlignment = TextAlignment.Center }; _spinnerViewActivityIndicator = new ActivityIndicator() { Color = Color.White }; // Rounded Box relativeLayout.Children.AddInOrigo(_roundedBox, 120, 100); // Progress Bar //_spinnerViewProgressBar.IsVisible = this.ShowProgress; _spinnerViewProgressBar.Opacity = this.ShowProgress ? 1 : 0; _spinnerViewProgressBar.Progress = this.Progress; relativeLayout.Children.Add(_spinnerViewProgressBar, xConstraint:Constraint.RelativeToView(_roundedBox, (RelativeLayout arg1, View arg2) => { return arg2.Bounds.Left + 10; }), yConstraint:Constraint.RelativeToView(_roundedBox, (RelativeLayout arg1, View arg2) => { return arg2.Bounds.Bottom - 15; }), widthConstraint:Constraint.RelativeToView(_roundedBox, (RelativeLayout arg1, View arg2) => { return arg2.Bounds.Width - 20; }), heightConstraint:Constraint.Constant(10)); // Label _spinnerViewLabel.Text = this.Message; relativeLayout.Children.Add(_spinnerViewLabel, xConstraint:Constraint.RelativeToView(_roundedBox, (RelativeLayout arg1, View arg2) => { return arg2.Bounds.Left + 10; }), yConstraint:Constraint.RelativeToView(_roundedBox, (RelativeLayout arg1, View arg2) => { return arg2.Bounds.Top + 5; }), widthConstraint:Constraint.RelativeToView(_roundedBox, (RelativeLayout arg1, View arg2) => { return arg2.Bounds.Width - 20; })); // Activity Indicator relativeLayout.Children.AddInOrigo(_spinnerViewActivityIndicator, 50, 50); // Return this.Content = relativeLayout; }