protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); if (this.pagerPage == null) { this.pagerPage = new ViewPagerPage() { FragmentManager = this.FragmentManager }; this.visualRoot.Child = pagerPage; } // this will start Navigation to first tab this.ActionBar.NavigationMode = ActionBarNavigationMode.Tabs; var styledAttributes = this.Theme.ObtainStyledAttributes(new int[] { Android.Resource.Attribute.ActionBarSize, Android.Resource.Attribute.ActionBarStyle }); var mActionBarSize = (int)styledAttributes.GetDimension(0, 0); var actionbarStyleId = styledAttributes.GetResourceId(1, 0); styledAttributes.Recycle(); styledAttributes = this.Theme.ObtainStyledAttributes(actionbarStyleId, new int[] { Android.Resource.Attribute.BackgroundStacked }); var tabsBackground = styledAttributes.GetDrawable(0); styledAttributes.Recycle(); rootLayout = new RootLayout(this); this.rootLayout.SetBackgroundDrawable(tabsBackground); rootLayout.SetPadding(0, mActionBarSize, 0, 0); this.Window.DecorView.RootView.ViewTreeObserver.AddOnGlobalLayoutListener(this); frameLayout = new FrameLayout(this); frameLayout.Id = this.fragmentPageFrameLayoutResourceId; frameLayout.Visibility = ViewStates.Gone; rootLayout.SizeChanged += (s, e) => UpdateRootLayouts(); this.pagerPage.ViewPager.LayoutChange += ViewPagerLayotChange; this.pagerPage.ViewPager.PageSelected += Pager_PageSelected; rootLayout.AddView(this.pagerPage.ViewPager, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)); rootLayout.AddView(frameLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)); this.SetContentView(rootLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); RootLayout rootLayout = new RootLayout(this); FrameLayout frgmCont = new FrameLayout(this); frgmCont.Id = this.fragmentPageFrameLayoutResourceId; rootLayout.AddView(frgmCont, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)); rootLayout.SizeChanged += (s, e) => { this.PageHeight = rootLayout.Height; this.PageWidth = rootLayout.Width; var dpiPageSize = new RectangleF( 0.0f, 0.0f, ScreenProperties.ConvertPixelsToDPI(this.PageWidth), ScreenProperties.ConvertPixelsToDPI(this.PageHeight)); AppercodeVisualRoot.Instance.Arrange(dpiPageSize); }; this.SetContentView(rootLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)); this.Navigate(this.StartPage, null, NavigationType.Default); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); if (this.pagerPage == null) { this.pagerPage = new ViewPagerPage() { FragmentManager = this.FragmentManager }; this.visualRoot.Child = pagerPage; } // this will start Navigation to first tab this.ActionBar.NavigationMode = ActionBarNavigationMode.Tabs; var styledAttributes = this.Theme.ObtainStyledAttributes(new int[] { Android.Resource.Attribute.ActionBarSize, Android.Resource.Attribute.ActionBarStyle }); var mActionBarSize = (int)styledAttributes.GetDimension(0, 0); var actionbarStyleId = styledAttributes.GetResourceId(1, 0); styledAttributes.Recycle(); styledAttributes = this.Theme.ObtainStyledAttributes(actionbarStyleId, new int[] { Android.Resource.Attribute.BackgroundStacked }); var tabsBackground = styledAttributes.GetDrawable(0); styledAttributes.Recycle(); rootLayout = new RootLayout(this); this.rootLayout.SetBackgroundDrawable(tabsBackground); rootLayout.SetPadding(0, mActionBarSize, 0, 0); this.Window.DecorView.RootView.ViewTreeObserver.AddOnGlobalLayoutListener(this); frameLayout = new FrameLayout(this); frameLayout.Id = this.fragmentPageFrameLayoutResourceId; frameLayout.Visibility = ViewStates.Gone; rootLayout.SizeChanged += (s, e) => UpdateRootLayouts(); this.pagerPage.ViewPager.LayoutChange += ViewPagerLayotChange; this.pagerPage.ViewPager.PageSelected += Pager_PageSelected; rootLayout.AddView(this.pagerPage.ViewPager, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent)); rootLayout.AddView(frameLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent)); this.SetContentView(rootLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent)); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); RootLayout rootLayout = new RootLayout(this); FrameLayout frgmCont = new FrameLayout(this); frgmCont.Id = this.fragmentPageFrameLayoutResourceId; rootLayout.AddView(frgmCont, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent)); rootLayout.SizeChanged += (s, e) => { this.PageHeight = rootLayout.Height; this.PageWidth = rootLayout.Width; RectangleF dpiPageSize = new System.Drawing.RectangleF(0.0f, 0.0f, ScreenProperties.ConvertPixelsToDPI(this.PageWidth), ScreenProperties.ConvertPixelsToDPI(this.PageHeight)); AppercodeVisualRoot.Instance.Arrange(dpiPageSize); }; this.SetContentView(rootLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent)); this.Navigate(this.StartPage, null, NavigationType.Default); }