public void Setbtn(ActionButtonView v) { _renderer = v; SetRippleColor(ColorStateList.ValueOf(v.SelectedColor.ToAndroid())); BackgroundTintList = ColorStateList.ValueOf(v.BackgroundColor.ToAndroid()); SetSize(); if (!string.IsNullOrWhiteSpace(v.Icon)) { SetIcon(v.Icon); } }
private void Wireup() { var btn = new ActionButtonView() { BackgroundColor = Color.Aqua, SelectedColor = Color.Brown, HeightRequest = 50, Icon = "logo.png" }; btn.Margin = new Thickness(20, 10, 10, Device.RuntimePlatform == Device.Android ? 160 : 10); var btnSub1 = new ActionButtonView() { BackgroundColor = Color.IndianRed, HeightRequest = 50, SelectedColor = Color.Pink, Icon = "tab_feed.png" }; var btnSub2 = new ActionButtonView() { BackgroundColor = Color.Orange, HeightRequest = 50, SelectedColor = Color.Pink, Icon = "logo.png" }; var btnSub3 = new ActionButtonView() { BackgroundColor = Color.OrangeRed, HeightRequest = 50, SelectedColor = Color.Pink, Icon = "logo.png" }; var btnSub4 = new ActionButtonView() { BackgroundColor = Color.Maroon, HeightRequest = 50, SelectedColor = Color.Pink, Icon = "logo.png" }; var btnSub5 = new ActionButtonView() { BackgroundColor = Color.Lime, HeightRequest = 50, SelectedColor = Color.Pink, Icon = "logo.png" }; var btnSub6 = new ActionButtonView() { BackgroundColor = Color.LightGreen, SelectedColor = Color.Pink, Icon = "logo.png" }; btnSub1.ClickActionButton += BtnSub1_ClickActionButton; btnSub2.ClickActionButton += BtnSub2_ClickActionButton; btnSub3.ClickActionButton += BtnSub3_ClickActionButton; btnSub4.ClickActionButton += BtnSub4_ClickActionButton; COAFloatingactionbutton.Current.SubViews.Add(btnSub1); COAFloatingactionbutton.Current.SubViews.Add(btnSub2); COAFloatingactionbutton.Current.SubViews.Add(btnSub3); COAFloatingactionbutton.Current.SubViews.Add(btnSub4); COAFloatingactionbutton.Current.SubViews.Add(btnSub5); btn.ClickActionButton += Btn_ClickActionButton; COAFloatingactionbutton.Current.ActionOrientation = StackActionOrientation.Center; COAFloatingactionbutton.Current.OpeningType = ActionOpeningType.Circle; COAFloatingactionbutton.Current.CircleAngle = 150; COAFloatingactionbutton.Current.MainButtonView = btn; COAFloatingactionbutton.Current.Open(); }
public CustomFloatingactionbutton(ActionButtonView View) { _view = View; SetIcon(); Layer.CornerRadius = (nfloat)_view.HeightRequest / 2; BackgroundColor = _view.BackgroundColor.ToUIColor(); heightConstraint = HeightAnchor.ConstraintEqualTo((nfloat)View.HeightRequest); heightConstraint.Active = true; widthConstraint = WidthAnchor.ConstraintEqualTo((nfloat)View.HeightRequest); widthConstraint.Active = true; TouchDown += delegate(object sender, EventArgs e) { UIView.Animate(0.1, 0, UIViewAnimationOptions.Autoreverse, () => { BackgroundColor = View.SelectedColor.ToUIColor(); }, () => { BackgroundColor = View.BackgroundColor.ToUIColor(); }); View.ClickAction(); }; _view.PropertyChanged += _view_PropertyChanged; }
public CustomFloatingactionbutton(Context context, ActionButtonView renderer, int spacing) : base(context) { _spacing = spacing; Setbtn(renderer); renderer.PropertyChanged += Renderer_PropertyChanged; }