public void FillDeviceListView(List <string> _deviceList) { if (_deviceList != null) { deviceList = _deviceList; this.mActivity.RunOnUiThread(() => { deviceListAdapter = new ArrayAdapter <string>(this.mActivity, Resource.Layout.listviewtemplate, Resource.Id.lbltransparent, deviceList); deviceListView.Adapter = deviceListAdapter; tabHost.SetCurrentTabByTag("Tab1"); }); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(_layoutId); var rootView = Window.DecorView.RootView; EventHandler onGlobalLayout = null; onGlobalLayout = (sender, args) => { rootView.ViewTreeObserver.GlobalLayout -= onGlobalLayout; ViewModel?.Appeared(); }; rootView.ViewTreeObserver.GlobalLayout += onGlobalLayout; InitializeTabHost(savedInstanceState); if (savedInstanceState != null) { _tabHost.SetCurrentTabByTag(savedInstanceState.GetString(SavedTabIndexStateKey)); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.fragment_tabs); tabHost = FindViewById <TabHost>(Android.Resource.Id.TabHost); tabHost.Setup(); tabManager = new TabManager(this, tabHost, Resource.Id.realtabcontent); tabManager.AddTab(tabHost.NewTabSpec("simple").SetIndicator("Simple"), Java.Lang.Class.FromType(typeof(FragmentStackSupport.CountingFragment)), null); tabManager.AddTab(tabHost.NewTabSpec("contacts").SetIndicator("Custom"), Java.Lang.Class.FromType(typeof(LoaderCursorSupport.CursorLoaderListFragment)), null); /*tabManager.AddTab(tabHost.NewTabSpec("contacts").SetIndicator("Contacts"), * LoaderCursorSupport.CursorLoaderListFragment.class, null); * tabManager.AddTab(tabHost.NewTabSpec("custom").SetIndicator("Custom"), * LoaderCustomSupport.AppListFragment.class, null); * tabManager.AddTab(mttabHost.NewTabSpec("throttle").SetIndicator("Throttle"), * LoaderThrottleSupport.ThrottledLoaderListFragment.class, null); */ if (savedInstanceState != null) { tabHost.SetCurrentTabByTag(savedInstanceState.GetString("tab")); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(R.Layouts.fragment_tabs_pager); mTabHost = (TabHost)FindViewById(global::Android.R.Id.Tabhost); mTabHost.Setup(); mViewPager = (ViewPager)FindViewById(R.Ids.pager); mTabsAdapter = new TabsAdapter(this, mTabHost, mViewPager); mTabsAdapter.AddTab(mTabHost.NewTabSpec("simple").SetIndicator("Simple"), typeof(FragmentStackSupport.CountingFragment), null); mTabsAdapter.AddTab(mTabHost.NewTabSpec("contacts").SetIndicator("Contacts"), typeof(LoaderCursorSupport.CursorLoaderListFragment), null); mTabsAdapter.AddTab(mTabHost.NewTabSpec("custom").SetIndicator("Custom"), typeof(LoaderCustomSupport.AppListFragment), null); mTabsAdapter.AddTab(mTabHost.NewTabSpec("throttle").SetIndicator("Throttle"), typeof(LoaderThrottleSupport.ThrottledLoaderListFragment), null); if (savedInstanceState != null) { mTabHost.SetCurrentTabByTag(savedInstanceState.GetString("tab")); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.LiveScoreTab); Console.WriteLine("LiveScoreTabActivity"); CreateTab(typeof(TodayLiveScoreActivity), "today", "Today", Resource.Drawable.livescore_state); TabHost.SetCurrentTabByTag("today"); TabChangerListener.setTabColor(TabHost); TabHost.TabWidget.GetChildAt(0).Click += (object sender, EventArgs e) => { isSelected(0); setColor(TabHost); TabHost.SetCurrentTabByTag("yesterday"); }; TabHost.TabWidget.GetChildAt(1).Click += (object sender, EventArgs e) => { isSelected(1); setColor(TabHost); TabHost.SetCurrentTabByTag("today"); }; // Create your application here }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.MainTab); Console.WriteLine("MainTabActivity"); if (Globals.IsLoggedIn()) { CreateTab(typeof(NewsGroupActivity), "news", "News", Resource.Drawable.news_state); } else { CreateTab(typeof(NewsActivity), "news", "News", Resource.Drawable.news_state); } CreateTab(typeof(PictureGroupActivity), "pictures", "Pictures", Resource.Drawable.pictures_state); CreateTab(typeof(VideoActivity), "video", "Video", Resource.Drawable.video_state); CreateTab(typeof(TodayLiveScoreActivity), "livescore", "LiveScore", Resource.Drawable.livescore_state); this.localWebView = FindViewById <ImageView> (Resource.Id.AdWebView); getAdView(); TabHost.TabWidget.GetChildAt(0).Click += (object sender, EventArgs e) => { getAdView(); isSelected(0); setColor(TabHost); TabHost.SetCurrentTabByTag("news"); }; TabHost.TabWidget.GetChildAt(1).Click += (object sender, EventArgs e) => { getAdView(); isSelected(1); setColor(TabHost); TabHost.SetCurrentTabByTag("pictures"); }; TabHost.TabWidget.GetChildAt(2).Click += (object sender, EventArgs e) => { getAdView(); isSelected(2); setColor(TabHost); TabHost.SetCurrentTabByTag("video"); }; TabHost.TabWidget.GetChildAt(3).Click += (object sender, EventArgs e) => { getAdView(); isSelected(3); setColor(TabHost); TabHost.SetCurrentTabByTag("livescore"); }; localWebView.Click += (s, arg) => { var uri = Android.Net.Uri.Parse(this.model.Impression); var intent = new Intent(Intent.ActionView, uri); StartActivity(intent); }; }
protected override void Refresh() { string selectedTag = _tabHost.CurrentTabTag; var oldValues = new Dictionary <string, TabInfo>(_tabToContent); _tabHost.CurrentTab = 0; _tabHost.ClearAllTabs(); _tabToContent.Clear(); int count = ItemsSource.Count(); for (int i = 0; i < count; i++) { var tabInfo = TryRecreateTabInfo(i, oldValues); _tabHost.AddTab(tabInfo.TabSpec); } foreach (var oldValue in oldValues) { RemoveTab(oldValue.Value); } if (count == 0) { OnEmptyTab(); } else { if (selectedTag == null) { _tabHost.CurrentTab = 0; if (_selectedItemMember != null) { _selectedItemMember.SetValue(_tabHost, new[] { GetItem(0) }); } } else { _tabHost.SetCurrentTabByTag(selectedTag); } } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(_layoutId); InitializeTabHost(savedInstanceState); if (savedInstanceState != null) { _tabHost.SetCurrentTabByTag(savedInstanceState.GetString(SavedTabIndexStateKey)); } }
private void InitTabMain() { TabHost tabHost = FindViewById <TabHost> (Resource.Id.tabHostMain); tabHost.Setup(); TabHost.TabSpec tabSpec; /* * tabSpec = tabHost.NewTabSpec ("tag0"); * View v0 = this.LayoutInflater.Inflate (Resource.Layout.TabHeader, null); * (v0.FindViewById(Resource.Id.tViewHeader) as TextView).Text = "В ефірі"; * v0.SetBackgroundResource (Resource.Drawable.tab_icon_selector); * tabSpec.SetIndicator (v0); * tabSpec.SetContent (Resource.Id.linearLayout8); * tabHost.AddTab (tabSpec);*/ tabSpec = tabHost.NewTabSpec("tag1"); View v1 = this.LayoutInflater.Inflate(Resource.Layout.TabHeader, null); (v1.FindViewById(Resource.Id.tViewHeader) as TextView).Text = "Останні"; v1.SetBackgroundResource(Resource.Drawable.tab_icon_selector); tabSpec.SetIndicator(v1); tabSpec.SetContent(Resource.Id.layoutHistoryPlay); tabHost.AddTab(tabSpec); tabSpec = tabHost.NewTabSpec("tag2"); View v2 = this.LayoutInflater.Inflate(Resource.Layout.TabHeader, null); (v2.FindViewById(Resource.Id.tViewHeader) as TextView).Text = "Топ 10"; v2.SetBackgroundResource(Resource.Drawable.tab_icon_selector); tabSpec.SetIndicator(v2); tabSpec.SetContent(Resource.Id.layoutTopTen); tabHost.AddTab(tabSpec); /* * tabSpec = tabHost.NewTabSpec ("tag3"); * View v3 = this.LayoutInflater.Inflate (Resource.Layout.TabHeader, null); * (v3.FindViewById(Resource.Id.tViewHeader) as TextView).Text = "Нові пісні"; * v3.SetBackgroundResource (Resource.Drawable.tab_icon_selector); * tabSpec.SetIndicator (v3); * tabSpec.SetContent (Resource.Id.linearLayout8); * tabHost.AddTab (tabSpec); * * tabSpec = tabHost.NewTabSpec ("tag4"); * View v4 = this.LayoutInflater.Inflate (Resource.Layout.TabHeader, null); * (v4.FindViewById(Resource.Id.tViewHeader) as TextView).Text = "Подкасти"; * v4.SetBackgroundResource (Resource.Drawable.tab_icon_selector); * tabSpec.SetIndicator (v4); * tabSpec.SetContent (Resource.Id.linearLayout8); * tabHost.AddTab (tabSpec);*/ tabHost.SetCurrentTabByTag("tag1"); }
/// <summary> /// Initialize the tabs and set views and identifiers for the tabs /// </summary> /// <param name="view">View.</param> public void InitializeTab(View view) { TabHost.TabSpec spec1 = mTabHost.NewTabSpec("Monthly"); spec1.SetContent(Resource.Id.realtabcontent); spec1.SetIndicator(this.Activity.LayoutInflater.Inflate(Resource.Layout.statistic_tab_button_month, null)); //"Monthly", Resource.Drawable.statistic_date48); mTabHost.AddTab(spec1); TabHost.TabSpec spec2 = mTabHost.NewTabSpec("By Date"); spec2.SetContent(Resource.Id.realtabcontent); spec2.SetIndicator(this.Activity.LayoutInflater.Inflate(Resource.Layout.statistic_tab_button_date, null)); //"By Date", Resource.Drawable.statistic_month); mTabHost.AddTab(spec2); for (int i = 0; i < mTabHost.TabWidget.ChildCount; i++) { View tab = mTabHost.TabWidget.GetChildAt(i); tab.SetBackgroundResource(Resource.Drawable.main_button_selector); tab.SetMinimumHeight(18); } mTabHost.SetCurrentTabByTag("By Date"); mTabHost.SetCurrentTabByTag("Monthly"); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(_layoutId); _view = Window.DecorView.RootView; _view.ViewTreeObserver.AddOnGlobalLayoutListener(this); InitializeTabHost(savedInstanceState); if (savedInstanceState != null) { _tabHost.SetCurrentTabByTag(savedInstanceState.GetString(SavedTabIndexStateKey)); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); MenuId = Resource.Menu.mainmenu; SetContentView(Resource.Layout.fragment_tabs); _tabHost = FindViewById <TabHost>(Android.Resource.Id.TabHost); _tabHost.Setup(); _viewPager = FindViewById <ViewPager>(Resource.Id.pager); _tabsAdapter = new TabsAdapter(this, _tabHost, _viewPager); LegacyBar = FindViewById <Library.Bar.LegacyBar>(Resource.Id.actionbar); LegacyBar.Title = "Look Fragments"; AddHomeAction(typeof(HomeActivity), Resource.Drawable.icon); var action = new MenuItemLegacyBarAction(this, Resource.Id.menu_search, Resource.Drawable.ic_action_search_dark, Resource.String.menu_string_search); LegacyBar.AddAction(action); TabHost.TabSpec spec = _tabHost.NewTabSpec("tv"); spec.SetIndicator("Tab 1", Resources.GetDrawable(Resource.Drawable.icon)); _tabsAdapter.AddTab(spec, Class.FromType(typeof(FramgmentTab1)), null); spec = _tabHost.NewTabSpec("tab2"); spec.SetIndicator("Tab 2", Resources.GetDrawable(Resource.Drawable.icon)); _tabsAdapter.AddTab(spec, Class.FromType(typeof(FramgmentTab2)), null); if (bundle != null) { _tabHost.SetCurrentTabByTag(bundle.GetString("tab")); } else { _tabHost.CurrentTab = 0; } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.fragment_tabs_pager); tabHost = FindViewById <TabHost>(Android.Resource.Id.TabHost); tabHost.Setup(); viewPager = FindViewById <ViewPager>(Resource.Id.pager); tabsAdapter = new TabsAdapter(this, tabHost, viewPager); tabsAdapter.AddTab(tabHost.NewTabSpec("simple").SetIndicator("Simple"), Java.Lang.Class.FromType(typeof(FragmentStackSupport.CountingFragment)), null); tabsAdapter.AddTab(tabHost.NewTabSpec("contacts").SetIndicator("Custom"), Java.Lang.Class.FromType(typeof(LoaderCursorSupport.CursorLoaderListFragment)), null); if (savedInstanceState != null) { tabHost.SetCurrentTabByTag(savedInstanceState.GetString("tab")); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.fragment_tabs_pager); tabHost = FindViewById <TabHost>(Android.Resource.Id.TabHost); tabHost.Setup(); viewPager = FindViewById <ViewPager>(Resource.Id.pager); viewPager.OffscreenPageLimit = 5; tabsAdapter = new TabsAdapter(this, tabHost, viewPager); tabsAdapter.AddTab(tabHost.NewTabSpec("Goal").SetIndicator(string.Empty, Resources.GetDrawable(Resource.Drawable.target)), Java.Lang.Class.FromType(typeof(GoalFragment)), null); tabsAdapter.AddTab(tabHost.NewTabSpec("Activities").SetIndicator(string.Empty, Resources.GetDrawable(Resource.Drawable.activities)), Java.Lang.Class.FromType(typeof(ActivitiesFragment)), null); tabsAdapter.AddTab(tabHost.NewTabSpec("Contacts").SetIndicator(string.Empty, Resources.GetDrawable(Resource.Drawable.contacts)), Java.Lang.Class.FromType(typeof(ContactsFragment)), null); tabsAdapter.AddTab(tabHost.NewTabSpec("Report").SetIndicator(string.Empty, Resources.GetDrawable(Resource.Drawable.report)), Java.Lang.Class.FromType(typeof(ReportsFragment)), null); if (savedInstanceState != null) { tabHost.SetCurrentTabByTag(savedInstanceState.GetString(tabKeyString)); } }
protected override void Refresh() { try { _ingoreTabChanged = true; string oldTag = TabHost.CurrentTabTag; var oldValues = new Dictionary <string, TabInfo>(_tabToContent); var oldIndex = TabHost.CurrentTab; _tabToContent.Clear(); var manager = GetCollectionViewManager(); if (manager == null) { TabHost.CurrentTab = 0; TabHost.ClearAllTabs(); } else { manager.Clear(TabHost); } int count = ItemsSource.Count(); for (int i = 0; i < count; i++) { var tabInfo = TryRecreateTabInfo(i, oldValues); if (manager == null) { TabHost.AddTab(tabInfo.TabSpec); } else { manager.Insert(TabHost, i, tabInfo.TabSpec); } } foreach (var oldValue in oldValues) { RemoveTabDelegate(this, oldValue.Value); } _ingoreTabChanged = false; if (count == 0) { OnEmptyTab(); } else { if (oldTag != null && _tabToContent.ContainsKey(oldTag)) { TabHost.SetCurrentTabByTag(oldTag); } else { var maxIndex = TabHost.TabWidget.TabCount - 1; while (oldIndex > maxIndex) { --oldIndex; } if (oldIndex >= 0) { TabHost.CurrentTab = oldIndex; } oldTag = TabHost.CurrentTabTag; } OnTabChanged(oldTag); } } finally { _ingoreTabChanged = false; } }
void Pager_PageSelected(object sender, ViewPager.PageSelectedEventArgs e) { tabHost.SetCurrentTabByTag(Tags[e.Position]); }