protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.activity_main); if (bundle != null) { _useAdapter2 = bundle.GetBoolean("useAdapter2", false); var colorInt = bundle.GetInt("color", -1); if (colorInt != -1) { _currentColor = new Color(colorInt); } } _drawableCallback = new DrawableCallback(this); _tabs = FindViewById <PagerSlidingTabStrip.PagerSlidingTabStrip>(Resource.Id.tabs); _pager = FindViewById <ViewPager>(Resource.Id.pager); int pageMargin = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 4, Resources.DisplayMetrics); _pager.PageMargin = pageMargin; //_pager.Adapter = _adapter; InitAdapter(); //_tabs.SetViewPager(_pager); ChangeColor(_currentColor); }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.DashboardActivity); //set the height of the tab view var tabView = FindViewById (Resource.Id.tabs); tabView.LayoutParameters.Height = Resources.DisplayMetrics.HeightPixels / 18; var toolbar = FindViewById<Toolbar> (Resource.Id.toolbar_dash); //set the height of the toolbar according to the screen height toolbar.LayoutParameters.Height = Resources.DisplayMetrics.HeightPixels / 20; var AccountInfo = App.Instance.GetCacheItem<AccountInfo> (DataCacheEnum.CURRENTACCOUNT); //deal with the size of the header of dashboard var actionBar_title = FindViewById (Resource.Id.toolbar_dash); actionBar_title.LayoutParameters.Height = Resources.DisplayMetrics.HeightPixels / 10; SetSupportActionBar (toolbar); if (AccountInfo != null) { SupportActionBar.Title = AccountInfo.AccountName; } else { SupportActionBar.Title = "Dashboard"; } _tabs = FindViewById<PagerSlidingTabStrip.PagerSlidingTabStrip> (Resource.Id.tabs); _pager = FindViewById<NoScrollViewPager> (Resource.Id.pager); _adapter = new RSPagerAdapter (SupportFragmentManager); _pager.Adapter = _adapter; _tabs.SetViewPager (_pager); }
public void UpdateTabStyle(View view, PagerSlidingTabStrip.PagerSlidingTabStrip owner, int position) { TextView textView = view.FindViewById <TextView>(Resource.Id.tab_text); if (textView != null) { _textTabProvider.UpdateTabStyle(textView, owner, position); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (Dialog != null) { Dialog.Window.RequestFeature(WindowFeatures.NoTitle); Dialog.Window.SetBackgroundDrawableResource(Android.Resource.Color.Transparent); } View root = inflater.Inflate(Resource.Layout.fragment_quick_contact, container, false); _tabs = root.FindViewById<PagerSlidingTabStrip.PagerSlidingTabStrip>(Resource.Id.tabs); _pager = root.FindViewById<ViewPager>(Resource.Id.pager); _adapter = new ContactPagerAdapter(Activity); _pager.Adapter = _adapter; _tabs.SetViewPager(_pager); return root; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (Dialog != null) { Dialog.Window.RequestFeature(WindowFeatures.NoTitle); Dialog.Window.SetBackgroundDrawableResource(Android.Resource.Color.Transparent); } View root = inflater.Inflate(Resource.Layout.fragment_quick_contact, container, false); _tabs = root.FindViewById <PagerSlidingTabStrip.PagerSlidingTabStrip>(Resource.Id.tabs); _pager = root.FindViewById <ViewPager>(Resource.Id.pager); _adapter = new ContactPagerAdapter(Activity); _pager.Adapter = _adapter; _tabs.SetViewPager(_pager); return(root); }
public View GetTab(PagerSlidingTabStrip.PagerSlidingTabStrip owner, ViewGroup root, int position, View recycled = null) { //TODO: you intend to add events to the ITabProvider interface to //fire if a tab is knowingly updated in such a way that will affect it's size //You also intend to add a public method on the TabStrip itself - either for one tab, //all tabs or most likely both of these. Doing for all will probably just mean calling //requestlayout, then invalidate //what we're saying here is that any view that's previously been inflated is fine to be re-used so long as it's re-bound if (recycled != null) { return(recycled); } var inflater = (LayoutInflater)owner.Context.GetSystemService(LayoutInflaterService); var view = inflater.Inflate(Resource.Layout.custom_tab, root, false) as ViewGroup; return(view); }
public void UpdateTab(View view, PagerSlidingTabStrip.PagerSlidingTabStrip owner, int position, string hint = null) { ProgressBar bar = view.FindViewById <ProgressBar>(Resource.Id.tab_progress); TextView textView = view.FindViewById <TextView>(Resource.Id.tab_text); textView.Text = owner.TabTextAllCaps ? _titles[position].ToUpper() : _titles[position]; if (SharedState.GetInProgress(position)) { bar.Visibility = ViewStates.Visible; } else { bar.Visibility = ViewStates.Gone; } bar.Dispose(); textView.Dispose(); OnTabUpdated(position); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.activity_main); if (bundle != null) { _useAdapter2 = bundle.GetBoolean("useAdapter2", false); var colorInt = bundle.GetInt("color", -1); if(colorInt != -1) _currentColor = new Color(colorInt); } _drawableCallback = new DrawableCallback(this); _tabs = FindViewById<PagerSlidingTabStrip.PagerSlidingTabStrip>(Resource.Id.tabs); _pager = FindViewById<ViewPager>(Resource.Id.pager); int pageMargin = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 4, Resources.DisplayMetrics); _pager.PageMargin = pageMargin; //_pager.Adapter = _adapter; InitAdapter(); //_tabs.SetViewPager(_pager); ChangeColor(_currentColor); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.FirstView); var existingDialog = (AddTorrentView)SupportFragmentManager.FindFragmentByTag(TorrentDialogTagName); if (existingDialog != null) { existingDialog.ViewModel = ((FirstViewModel)ViewModel).AddTorrentViewModel; } // PagerSlidingTabStrip and ViewPager initialisation var fragments = new List<MvxViewPagerFragmentAdapter.FragmentInfo> { new MvxViewPagerFragmentAdapter.FragmentInfo { FragmentType = typeof(TorrentsView), Title = "My tracked animes", ViewModel = ((FirstViewModel)ViewModel).TorrentsViewModel, }, new MvxViewPagerFragmentAdapter.FragmentInfo { FragmentType = typeof(BrowseView), Title = "All tracked animes", ViewModel = ((FirstViewModel)ViewModel).BrowseViewModel, }, }; viewPager = FindViewById<ViewPager>(Resource.Id.pager); pageIndicator = FindViewById<PagerSlidingTabStrip.PagerSlidingTabStrip>(Resource.Id.indicator); adapter = new MvxViewPagerFragmentAdapter(this, SupportFragmentManager, fragments); // Set the pager with an adapter: viewPager.Adapter = adapter; //Set the pager to the tabs control: pageIndicator.SetViewPager(viewPager); }