private void InvertLayoutThroughScale() { ViewGroup.ScaleY = -1; TabLayout tabLayout = null; ViewPager viewPager = null; for (int i = 0; i < ChildCount; ++i) { Android.Views.View view = (Android.Views.View)GetChildAt(i); if (view is TabLayout) { tabLayout = (TabLayout)view; } else if (view is ViewPager) { viewPager = (ViewPager)view; } } tabLayout.ScaleY = viewPager.ScaleY = -1; tabLayout.SetPadding(0, 50, 0, 50); tabLayout.Measure(0, 0); viewPager.SetPadding(0, -tabLayout.MeasuredHeight, 0, 0); }
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) { base.OnElementPropertyChanged(sender, e); TabLayout TabsLayout = null; for (int i = 0; i < this.ChildCount; ++i) { Android.Views.View view = (Android.Views.View)GetChildAt(i); if (view is TabLayout layout) { TabsLayout = layout; break; } } if ((Element as CustomTabbedPage).IsHidden) { TabsLayout.Visibility = ViewStates.Gone; } else { TabsLayout.Visibility = ViewStates.Visible; } TabsLayout.SetMinimumHeight(0); TabsLayout.SetPadding(0, 0, 0, 0); }
private void InvertLayoutThroughScale() { ViewGroup.ScaleY = -1; TabLayout tabLayout = null; ViewPager viewPager = null; for (int i = 0; i < ChildCount; ++i) { Android.Views.View view = (Android.Views.View)GetChildAt(i); if (view is TabLayout) { tabLayout = (TabLayout)view; } else if (view is ViewPager) { viewPager = (ViewPager)view; } } tabLayout.ScaleY = viewPager.ScaleY = -1; tabLayout.SetPadding(0, -30, 0, 0); viewPager.SetPadding(0, -tabLayout.MeasuredHeight, 0, 0); if (currentTab != tabLayout) { for (int j = 0; j < tabLayout.TabCount; j++) { TabLayout.Tab tab = tabLayout.GetTabAt(j); tab.SetCustomView(Resource.Layout.custom_tab_layout); var imageview = tab.CustomView.FindViewById <ImageView>(Resource.Id.icon); var tv = tab.CustomView.FindViewById <TextView>(Resource.Id.tv); tv.SetText(tab.Text, TextView.BufferType.Normal); imageview.SetBackgroundDrawable(tab.Icon); ColorStateList colors2 = null; if ((int)Build.VERSION.SdkInt >= 23) { colors2 = Resources.GetColorStateList(Resource.Color.icon_tab, Forms.Context.Theme); } else { colors2 = Resources.GetColorStateList(Resource.Color.icon_tab); tv.SetTextColor(colors2); } currentTab = tabLayout; } } }