コード例 #1
0
        protected override void OnElementChanged(ElementChangedEventArgs <TabbedPage> e)
        {
            base.OnElementChanged(e);
            var activity = (FormsAppCompatActivity)Context;

            if (e.NewElement != null)
            {
                var relativeLayout = this.GetChildAt(0) as Android.Widget.RelativeLayout;
                if (relativeLayout != null)
                {
                    bottomNarView = relativeLayout.GetChildAt(1).JavaCast <BottomNavigationView>();
                    bottomNarView.SetBackgroundColor(Android.Graphics.Color.White);
                    BottomNavigationViewUtils.SetShiftMode(bottomNarView, false, false);
                }
            }
        }
コード例 #2
0
        protected override void OnElementChanged(ElementChangedEventArgs <TabbedPage> e)
        {
            base.OnElementChanged(e);
            var activity = (FormsAppCompatActivity)Context;

            if (e.NewElement != null)
            {
                var relativeLayout = this.GetChildAt(0) as Android.Widget.RelativeLayout;
                if (relativeLayout != null)
                {
                    bottomNarView = relativeLayout.GetChildAt(1).JavaCast <BottomNavigationView>();
                    BottomNavigationViewUtils.SetShiftMode(bottomNarView, false, false);

                    floating = activity.LayoutInflater.Inflate(Resource.Layout.FloatingActionButton, null).JavaCast <FloatingActionButton>();

                    floating.Click += async delegate(object sender, EventArgs ev)
                    {
                        if (UserTokenSettings.Current.HasExpiresIn())
                        {
                            MessagingService.Current.SendMessage(MessageKeys.NavigateLogin);
                        }
                        else
                        {
                            if (this.Element.CurrentPage is StatusesTopTabbedPage)
                            {
                                await NavigationService.PushAsync(this.Element.Navigation, new StatusesEditPage(new Statuses()));
                            }
                            else if (this.Element.CurrentPage is QuestionsTopTabbedPage)
                            {
                                await NavigationService.PushAsync(this.Element.Navigation, new QuestionsEditPage(new Questions()));
                            }
                        }
                    };

                    var layoutParams = new Android.Widget.RelativeLayout.LayoutParams(Android.Widget.RelativeLayout.LayoutParams.WrapContent, Android.Widget.RelativeLayout.LayoutParams.WrapContent);
                    layoutParams.AddRule(LayoutRules.AlignParentRight);
                    layoutParams.AddRule(LayoutRules.AlignParentBottom);
                    layoutParams.AddRule(LayoutRules.Above, bottomNarView.Id);

                    floating.LayoutParameters = layoutParams;

                    relativeLayout.AddView(floating);
                }
            }
        }