Hiding Bottom navigation view in android Tabbed page rendering Issue, Viewpages not full covered once bottom navigation hides
#4,222 opened on Oct 26, 2018
Repository metrics
- Stars
- (5,644 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
Here, The TabbedpageRendering in the Android for bottom navigation view , you are fixed the "FormsViewPager" is always top on the Bottom navigation bar.
https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.Android/AppCompat/TabbedPageRenderer.cs Line no: 237 to 246 Method Name: protected override void OnElementChanged(ElementChangedEventArgs e)
var viewPagerParams = new AWidget.RelativeLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
viewPagerParams.AddRule(AWidget.LayoutRules.Above, _bottomNavigationView.Id);
FormsViewPager pager = _viewPager = CreateFormsViewPager(activity, e.NewElement);
pager.Id = Platform.GenerateViewId();
pager.AddOnPageChangeListener(this);
_relativeLayout.AddView(pager, viewPagerParams);
_relativeLayout.AddView(_bottomNavigationView, bottomNavigationViewLayoutParams);
Line No:239to260 method Name:protected override void OnLayout(bool changed, int l, int t, int r, int b) And onlayout also you are fixed the viewpages top on bottum navigation, you want to hide the bottum naviagation , the viewpager not fully fitted the screen, it was shows the gap .
if (IsBottomTabPlacement)
{
if (width <= 0 || height <= 0)
return;
_relativeLayout.Measure(
MeasureSpec.MakeMeasureSpec(width, MeasureSpecMode.Exactly),
MeasureSpec.MakeMeasureSpec(height, MeasureSpecMode.Exactly));
pager.Measure(MeasureSpecFactory.MakeMeasureSpec(width, MeasureSpecMode.AtMost), MeasureSpecFactory.MakeMeasureSpec(height, MeasureSpecMode.AtMost));
if (width > 0 && height > 0)
{
PageController.ContainerArea = new Rectangle(0, 0, context.FromPixels(width), context.FromPixels(height - _bottomNavigationView.MeasuredHeight));
SetNavigationRendererPadding(0, _bottomNavigationView.MeasuredHeight);
pager.Layout(0, 0, width, b);
// We need to measure again to ensure that the tabs show up
_relativeLayout.Measure(
MeasureSpec.MakeMeasureSpec(width, MeasureSpecMode.Exactly),
MeasureSpec.MakeMeasureSpec(height, MeasureSpecMode.Exactly));
_relativeLayout.Layout(0, 0, _relativeLayout.MeasuredWidth, _relativeLayout.MeasuredHeight);
}
}
`