android.widget.TabHost Java Examples
The following examples show how to use
android.widget.TabHost.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HelpFragment.java From RobotCA with GNU General Public License v3.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (view == null) { view = inflater.inflate(R.layout.fragment_help, container, false); TabHost mTabHost = (TabHost) view.findViewById(android.R.id.tabhost); mTabHost.setup(); ViewPager mViewPager = (ViewPager) view.findViewById(R.id.pager); TabsAdapter mTabsAdapter = new TabsAdapter(getActivity(), mTabHost, mViewPager); // Here we load the content for each tab. mTabsAdapter.addTab(mTabHost.newTabSpec("one").setIndicator("Setup"), PageOneFragment.class, null); mTabsAdapter.addTab(mTabHost.newTabSpec("two").setIndicator("Using"), PageTwoFragment.class, null); mTabsAdapter.addTab(mTabHost.newTabSpec("three").setIndicator("FAQ"), PageThreeFragment.class, null); } return view; }
Example #2
Source File: LauncherActivity.java From android-apps with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_launcher); TabHost tabHost = getTabHost(); TabSpec tab1 = tabHost.newTabSpec("First Tab"); TabSpec tab2 = tabHost.newTabSpec("Second Tab"); TabSpec tab3 = tabHost.newTabSpec("Third Tab"); tab1.setIndicator("Tab1",getResources().getDrawable(R.drawable.ic_launcher)); tab1.setContent(new Intent(this, Tab1Activity.class)); tab2.setIndicator("Tab2",getResources().getDrawable(R.drawable.ic_launcher)); tab2.setContent(new Intent(this, Tab2Activity.class)); tab3.setIndicator("Tab3",getResources().getDrawable(R.drawable.ic_launcher)); tab3.setContent(new Intent(this, Tab3Activity.class)); tabHost.addTab(tab1); tabHost.addTab(tab2); tabHost.addTab(tab3); }
Example #3
Source File: TabsContainer.java From giffun with Apache License 2.0 | 6 votes |
/** * Opens a brand new browser tab. * * @param directory The directory to open when this tab is initialized. */ protected BaseLayoutView openNewBrowserTab(File directory) { //Inflate the view's layout based on the selected layout. BaseLayoutView contentView = null; if (mFileBrowserView.getFileBrowserLayoutType() == FileBrowserView.FILE_BROWSER_LIST_LAYOUT) contentView = new ListLayoutView(mContext, mFileBrowserView.getAttributeSet(), mFileBrowserView).init(mTabContentLayout); contentView.setId(mTabHost.getTabWidget().getTabCount() + 1); mTabContentLayout.addView(contentView); //Add the new tab to the TabHost. String directoryName = directory.getAbsoluteFile().getName(); TabHost.TabSpec newTabSpec = mTabHost.newTabSpec(directoryName); newTabSpec.setIndicator(directoryName); newTabSpec.setContent(mTabHost.getTabWidget().getTabCount() + 1); mTabHost.addTab(newTabSpec); return contentView; }
Example #4
Source File: DocActivityView.java From Mupdf with Apache License 2.0 | 6 votes |
public void onShowSearch() { // "deselect" all the visible tabs by selecting the hidden (first) one TabHost tabHost = (TabHost)findViewById(R.id.tabhost); tabHost.setCurrentTabByTag("HIDDEN"); // show search as selected showSearchSelected(true); // hide all the other tabs hideAllTabs(); // show the search tab findViewById(R.id.searchTab).setVisibility(View.VISIBLE); mSearchText.getText().clear(); }
Example #5
Source File: NotepadActivityTest.java From aedict with GNU General Public License v3.0 | 6 votes |
public void testCorrectDisplayOfStoredCategories() { final Config cfg = AedictApp.getConfig(); cfg.setNotepadCategories(Arrays.asList("foo", "bar", "baz")); cfg.setNotepadItems(1, Arrays.asList(new DictEntry("母は留守です。", "はははです", "Foo!"))); tester.startActivity(); assertTrue(getActivity().findViewById(R.id.tabs).getVisibility() == View.VISIBLE); ((TabHost) getActivity().findViewById(R.id.tabs)).setCurrentTab(0); DictEntry e = (DictEntry) getActivity().getListView(0).getAdapter().getItem(0); assertEquals(new DictEntry("母は留守です。", "はははです", "Mother is."), e); ((TabHost) getActivity().findViewById(R.id.tabs)).setCurrentTab(1); e = (DictEntry) getActivity().getListView(1).getAdapter().getItem(0); assertEquals(new DictEntry("母は留守です。", "はははです", "Foo!"), e); ((TabHost) getActivity().findViewById(R.id.tabs)).setCurrentTab(2); assertEquals(1, getActivity().getListView(0).getAdapter().getCount()); assertEquals(1, getActivity().getListView(1).getAdapter().getCount()); assertEquals(0, getActivity().getListView(2).getAdapter().getCount()); }
Example #6
Source File: ReflectionExtractor.java From AndroidRipper with GNU Affero General Public License v3.0 | 6 votes |
/** * Set Listeners for the Widget * * @param ad * ActivityDescription instance * @param wd * WidgetDescription instance * @param v * Widget */ protected void setViewListeners(ActivityDescription ad, WidgetDescription wd, View v) { if (v instanceof android.opengl.GLSurfaceView == false && v instanceof View) { wd.setListeners(ReflectionHelper.reflectViewListeners(v)); } try { // Class.isInstance <-> instanceof if (Class.forName("com.android.internal.view.menu.IconMenuItemView").isInstance(v) && ad.hasMenu()) { wd.addListener("OnClickListener", true); } } catch (Throwable ex) { ex.printStackTrace(); } if (v instanceof android.widget.TabHost) { wd.addSupportedEvent(InteractionType.SWAP_TAB); } }
Example #7
Source File: BaseFragmentTabHost.java From FragmentMixViewPager with Apache License 2.0 | 6 votes |
public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args) { tabSpec.setContent(new DummyTabFactory(mContext)); String tag = tabSpec.getTag(); TabInfo info = new TabInfo(tag, clss, args); if (mAttached) { // If we are already attached to the window, then check to make // sure this tab's fragment is inactive if it exists. This shouldn't // normally happen. info.fragment = mFragmentManager.findFragmentByTag(tag); if (info.fragment != null && !info.fragment.isDetached()) { FragmentTransaction ft = mFragmentManager.beginTransaction(); // ft.detach(info.fragment); ft.hide(info.fragment); ft.commit(); } } mTabs.add(info); addTab(tabSpec); }
Example #8
Source File: NotepadActivityTest.java From aedict with GNU General Public License v3.0 | 6 votes |
public void testAddThreeCategories() { final Config cfg = AedictApp.getConfig(); tester.startActivity(); tester.optionMenu(2); tester.optionMenu(2); tester.optionMenu(2); assertTrue(getActivity().findViewById(R.id.tabs).getVisibility() == View.VISIBLE); ((TabHost) getActivity().findViewById(R.id.tabs)).setCurrentTab(0); ((TabHost) getActivity().findViewById(R.id.tabs)).setCurrentTab(1); ((TabHost) getActivity().findViewById(R.id.tabs)).setCurrentTab(2); DictEntry e = (DictEntry) getActivity().getListView(0).getAdapter().getItem(0); assertEquals(new DictEntry("母は留守です。", "はははです", "Mother is."), e); assertEquals(1, getActivity().getListView(0).getAdapter().getCount()); assertEquals(0, getActivity().getListView(1).getAdapter().getCount()); assertEquals(0, getActivity().getListView(2).getAdapter().getCount()); assertEquals(3, cfg.getNotepadCategories().size()); }
Example #9
Source File: FragmentTabHost.java From guideshow with MIT License | 6 votes |
public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args) { tabSpec.setContent(new DummyTabFactory(mContext)); String tag = tabSpec.getTag(); TabInfo info = new TabInfo(tag, clss, args); if (mAttached) { // If we are already attached to the window, then check to make // sure this tab's fragment is inactive if it exists. This shouldn't // normally happen. info.fragment = mFragmentManager.findFragmentByTag(tag); if (info.fragment != null && !info.fragment.isDetached()) { FragmentTransaction ft = mFragmentManager.beginTransaction(); ft.detach(info.fragment); ft.commit(); } } mTabs.add(info); addTab(tabSpec); }
Example #10
Source File: RobotiumWrapperRobot.java From AndroidRipper with GNU Affero General Public License v3.0 | 6 votes |
@Override public void updateWidgets () { home(); Debug.info(this, "Retrieving widgets"); //ArrayList<View> viewList = (isInAndOutFocusEnabled())?solo.getViews():solo.getCurrentViews(); ArrayList<View> viewList = solo.getViews(); for (View w: viewList) { String text = (w instanceof TextView)?": "+((TextView)w).getText().toString():""; Debug.info(this, "Found widget: id=" + w.getId() + " ("+ w.toString() + ")" + text); // + " in window at [" + xy[0] + "," + xy[1] + "] on screen at [" + xy2[0] + "," + xy2[1] +"]"); allViews.add(w); if (w.getId()>0) { theViews.put(w.getId(), w); // Add only if the widget has a valid ID } if (w instanceof TabHost) { this.tabs = (TabHost)w; Debug.info(this, "Found tabhost: id=" + w.getId()); } } }
Example #11
Source File: FragmentTabHost.java From MiBandDecompiled with Apache License 2.0 | 6 votes |
public void addTab(android.widget.TabHost.TabSpec tabspec, Class class1, Bundle bundle) { tabspec.setContent(new h(c)); String s = tabspec.getTag(); j j1 = new j(s, class1, bundle); if (h) { j.a(j1, d.findFragmentByTag(s)); if (j.a(j1) != null && !j.a(j1).isDetached()) { FragmentTransaction fragmenttransaction = d.beginTransaction(); fragmenttransaction.detach(j.a(j1)); fragmenttransaction.commit(); } } a.add(j1); addTab(tabspec); }
Example #12
Source File: FragmentTabHost.java From V.FlyoutTest with MIT License | 6 votes |
public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args) { tabSpec.setContent(new DummyTabFactory(mContext)); String tag = tabSpec.getTag(); TabInfo info = new TabInfo(tag, clss, args); if (mAttached) { // If we are already attached to the window, then check to make // sure this tab's fragment is inactive if it exists. This shouldn't // normally happen. info.fragment = mFragmentManager.findFragmentByTag(tag); if (info.fragment != null && !info.fragment.isDetached()) { FragmentTransaction ft = mFragmentManager.beginTransaction(); ft.detach(info.fragment); ft.commit(); } } mTabs.add(info); addTab(tabSpec); }
Example #13
Source File: TabTest.java From codeexamples-android with Eclipse Public License 1.0 | 6 votes |
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tab); TabHost host = (TabHost)findViewById(android.R.id.tabhost); TabSpec spec = host.newTabSpec("tab1"); spec.setContent(R.id.tab1); spec.setIndicator("Button1"); host.addTab(spec); spec = host.newTabSpec("tab2"); spec.setContent(R.id.tab2); spec.setIndicator("Next Button"); host.addTab(spec); spec = host.newTabSpec("tab3"); spec.setContent(R.id.tab3); spec.setIndicator("Just some text"); host.addTab(spec); }
Example #14
Source File: TabHandler.java From ssj with GNU General Public License v3.0 | 6 votes |
private void checkAnnotationTabs() { List<Component> iFileWriters = PipelineBuilder.getInstance().getComponentsOfClass(PipelineBuilder.Type.Consumer, IFileWriter.class); List<Component> trainers = PipelineBuilder.getInstance().getComponentsOfClass(PipelineBuilder.Type.Consumer, Trainer.class); if (iFileWriters.isEmpty() && trainers.isEmpty()) { removeComponentsOfClass(firstTabs, AnnotationTab.class); } else if (!containsOfClass(firstTabs, AnnotationTab.class)) { AnnotationTab annotationTab = new AnnotationTab(activity); TabHost.TabSpec annotationTabSpec = getTabSpecForITab(annotationTab); firstTabs.put(annotationTab, annotationTabSpec); } else //Annotation tab is already here, refresh it { getAnnotation().syncWithModel(); } }
Example #15
Source File: FragmentTabHost.java From V.FlyoutTest with MIT License | 6 votes |
public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args) { tabSpec.setContent(new DummyTabFactory(mContext)); String tag = tabSpec.getTag(); TabInfo info = new TabInfo(tag, clss, args); if (mAttached) { // If we are already attached to the window, then check to make // sure this tab's fragment is inactive if it exists. This shouldn't // normally happen. info.fragment = mFragmentManager.findFragmentByTag(tag); if (info.fragment != null && !info.fragment.isDetached()) { FragmentTransaction ft = mFragmentManager.beginTransaction(); ft.detach(info.fragment); ft.commit(); } } mTabs.add(info); addTab(tabSpec); }
Example #16
Source File: TabHandler.java From ssj with GNU General Public License v3.0 | 6 votes |
public TabHandler(Activity activity) { this.activity = activity; tabHost = (TabHost) activity.findViewById(R.id.id_tabHost); if (tabHost != null) { tabHost.setup(); //canvas canvas = new Canvas(this.activity); firstTabs.put(canvas, getTabSpecForITab(canvas)); //console console = new Console(this.activity); firstTabs.put(console, getTabSpecForITab(console)); //init tabs canvas.init(new PipeListener() { @Override public void viewChanged() { checkAdditionalTabs(); } }); console.init(); } }
Example #17
Source File: FragmentTabHost.java From android-recipes-app with Apache License 2.0 | 6 votes |
public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args) { tabSpec.setContent(new DummyTabFactory(mContext)); String tag = tabSpec.getTag(); TabInfo info = new TabInfo(tag, clss, args); if (mAttached) { // If we are already attached to the window, then check to make // sure this tab's fragment is inactive if it exists. This shouldn't // normally happen. info.fragment = mFragmentManager.findFragmentByTag(tag); if (info.fragment != null && !info.fragment.isDetached()) { FragmentTransaction ft = mFragmentManager.beginTransaction(); ft.detach(info.fragment); ft.commit(); } } mTabs.add(info); addTab(tabSpec); }
Example #18
Source File: MainActivity.java From android_tv_metro with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mTabHost = (TabHost)findViewById(android.R.id.tabhost); mTabHost.setup(); mTabs = (TabWidget)findViewById(android.R.id.tabs); ViewStub vStub = (ViewStub) findViewById(R.id.new_home_menu); mMenuContainer = (FrameLayout) vStub.inflate(); mViewPager = (ViewPager)findViewById(R.id.pager); mLoadingView = makeEmptyLoadingView(this, (RelativeLayout)findViewById(R.id.tabs_content)); setScrollerTime(800); albumItem = (DisplayItem) getIntent().getSerializableExtra("item"); setUserFragmentClass(); getSupportLoaderManager().initLoader(TabsGsonLoader.LOADER_ID, null, this); if (savedInstanceState != null) { mTabHost.setCurrentTabByTag(savedInstanceState.getString("tab")); } }
Example #19
Source File: MainActivity.java From financisto with GNU General Public License v2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); greenRobotBus = GreenRobotBus_.getInstance_(this); requestWindowFeature(Window.FEATURE_NO_TITLE); initialLoad(); final TabHost tabHost = getTabHost(); setupAccountsTab(tabHost); setupBlotterTab(tabHost); setupBudgetsTab(tabHost); setupReportsTab(tabHost); setupMenuTab(tabHost); MyPreferences.StartupScreen screen = MyPreferences.getStartupScreen(this); tabHost.setCurrentTabByTag(screen.tag); tabHost.setOnTabChangedListener(this); }
Example #20
Source File: MyTabHostActivity.java From sa-sdk-android with Apache License 2.0 | 6 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TabHost tabHost = getTabHost(); LayoutInflater.from(this).inflate(R.layout.main_tab, tabHost.getTabContentView(), true); /* 以上创建和添加标签页也可以用如下代码实现 */ tabHost.addTab(tabHost.newTabSpec("tab1").setIndicator("标签页一").setContent(R.id.tab01)); tabHost.addTab(tabHost.newTabSpec("tab2").setIndicator("标签页二").setContent(R.id.tab02)); tabHost.addTab(tabHost.newTabSpec("tab3").setIndicator("标签页三").setContent(R.id.tab03)); tabHost.setOnTabChangedListener(tabId -> { }); }
Example #21
Source File: PdDroidParty.java From PdDroidPublisher with GNU General Public License v3.0 | 6 votes |
public static TabHost createTabHost(Context context) { // Create the TabWidget (the tabs) TabWidget tabWidget = new TabWidget(context); tabWidget.setId(android.R.id.tabs); // Create the FrameLayout (the content area) FrameLayout frame = new FrameLayout(context); frame.setId(android.R.id.tabcontent); LinearLayout.LayoutParams frameLayoutParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, 1); frameLayoutParams.setMargins(4, 4, 4, 4); frame.setLayoutParams(frameLayoutParams); // Create the container for the above widgets LinearLayout tabHostLayout = new LinearLayout(context); tabHostLayout.setOrientation(LinearLayout.VERTICAL); tabHostLayout.addView(tabWidget); tabHostLayout.addView(frame); // Create the TabHost and add the container to it. TabHost tabHost = new TabHost(context, null); tabHost.addView(tabHostLayout); tabHost.setup(); return tabHost; }
Example #22
Source File: GestionAlumnos.java From android with GNU General Public License v2.0 | 6 votes |
private void cargaPestanas() { Resources res = getResources(); TabHost tabHost = (TabHost) findViewById(R.id.tabhost); tabHost.setup(); TabSpec tbListadoAlumnos = tabHost.newTabSpec(res.getString(R.string.listado_alumnos_title)); tbListadoAlumnos.setContent(R.id.tab1); tbListadoAlumnos.setIndicator(res.getString(R.string.listado_alumnos_title), res.getDrawable(android.R.drawable.ic_menu_slideshow)); tabHost.addTab(tbListadoAlumnos); TabSpec tbNuevoAlumno = tabHost.newTabSpec(res.getString(R.string.nuevo_alumno_title)); tbNuevoAlumno.setContent(R.id.tab2); tbNuevoAlumno.setIndicator(res.getString(R.string.nuevo_alumno_title), res.getDrawable(android.R.drawable.ic_menu_edit)); tabHost.addTab(tbNuevoAlumno); tabHost.setCurrentTab(0); tabHost.setOnTabChangedListener(this); }
Example #23
Source File: HelpFragment.java From RobotCA with GNU General Public License v3.0 | 5 votes |
/** * Creates a TabsAdapter. * @param activity The parent Activity * @param tabHost The TabHost * @param pager The ViewPager */ public TabsAdapter(FragmentActivity activity, TabHost tabHost, ViewPager pager) { super(activity.getSupportFragmentManager()); mContext = activity; mTabHost = tabHost; mViewPager = pager; mTabHost.setOnTabChangedListener(this); mViewPager.setAdapter(this); //noinspection deprecation // Needed for min API level mViewPager.setOnPageChangeListener(this); }
Example #24
Source File: HelpFragment.java From RobotCA with GNU General Public License v3.0 | 5 votes |
/** * Adds a tab to this TabsAdapter. * @param tabSpec The TabSpec for the tab * @param clss The class of the Fragment to be contained in the tab * @param args Arguments for the tab */ public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args) { tabSpec.setContent(new DummyTabFactory(mContext)); tabSpec.getTag(); TabInfo info = new TabInfo(clss, args); mTabs.add(info); mTabHost.addTab(tabSpec); notifyDataSetChanged(); }
Example #25
Source File: MainActivity.java From FragmentTabHost with Apache License 2.0 | 5 votes |
private void initTabHost() { //实例化FragmentTabHost对象 FragmentTabHost fragmentTabHost = (FragmentTabHost) findViewById(android.R.id.tabhost); fragmentTabHost.setup(this,getSupportFragmentManager(),android.R.id.tabcontent); //去掉分割线 fragmentTabHost.getTabWidget().setDividerDrawable(null); for (int i = 0; i<mTableItemList.size(); i++) { TabItem tabItem = mTableItemList.get(i); //实例化一个TabSpec,设置tab的名称和视图 TabHost.TabSpec tabSpec = fragmentTabHost.newTabSpec(tabItem.getTitleString()).setIndicator(tabItem.getView()); fragmentTabHost.addTab(tabSpec,tabItem.getFragmentClass(),null); //给Tab按钮设置背景 fragmentTabHost.getTabWidget().getChildAt(i).setBackgroundColor(getResources().getColor(R.color.main_bottom_bg)); //默认选中第一个tab if(i == 0) { tabItem.setChecked(true); } } fragmentTabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() { @Override public void onTabChanged(String tabId) { //重置Tab样式 for (int i = 0; i< mTableItemList.size(); i++) { TabItem tabitem = mTableItemList.get(i); if (tabId.equals(tabitem.getTitleString())) { tabitem.setChecked(true); }else { tabitem.setChecked(false); } } } }); }
Example #26
Source File: TabTestActivity.java From ans-android-sdk with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tabhost); //获取该activity里面的TabHost组件 TabHost tabhost=getTabHost(); //创建第一个tab页对象,TabSpec代表一个选项卡页面,要设置标题和内容,内容是布局文件中FrameLayout中 TabHost.TabSpec tab1=tabhost.newTabSpec("tab1"); tab1.setIndicator("已接电话");//设置标题 tab1.setContent(R.id.tab01);//设置内容 //添加tab页 tabhost.addTab(tab1); //创建第二个tab页对象 TabHost.TabSpec tab2=tabhost.newTabSpec("tab1"); tab2.setIndicator("已拨电话");//设置标题 tab2.setContent(R.id.tab02);//设置内容 //添加tab页 tabhost.addTab(tab2); //创建第三个tab页对象 TabHost.TabSpec tab3=tabhost.newTabSpec("tab1"); tab3.setIndicator("未接电话");//设置标题 tab3.setContent(R.id.tab03);//设置内容 //添加tab页 tabhost.addTab(tab3); }
Example #27
Source File: TabsAdapter.java From fdroidclient with GNU General Public License v3.0 | 5 votes |
TabsAdapter(Activity activity, TabHost tabHost, ViewPager pager) { context = activity; this.tabHost = tabHost; viewPager = pager; this.tabHost.setOnTabChangedListener(this); viewPager.setAdapter(this); viewPager.setOnPageChangeListener(this); }
Example #28
Source File: TabsAdapter.java From mytracks with Apache License 2.0 | 5 votes |
public TabsAdapter(FragmentActivity activity, TabHost tabHost, ViewPager viewPager) { super(activity.getSupportFragmentManager()); this.context = activity; this.tabHost = tabHost; this.viewPager = viewPager; this.tabHost.setOnTabChangedListener(this); this.viewPager.setAdapter(this); this.viewPager.setOnPageChangeListener(this); }
Example #29
Source File: MainActivity.java From iTab with Apache License 2.0 | 5 votes |
private void setTabs() { mTabHost = (TabHost) findViewById(android.R.id.tabhost); mTabHost.setup(); addTab("Home", TAG_1, createTabDrawable(R.drawable.home), R.id.text_view_home); addTab("Search", TAG_2, createTabDrawable(R.drawable.search), R.id.text_view_search); addTab("Favourites", TAG_3, createTabDrawable(R.drawable.star), R.id.text_view_favourites); addTab("Settings", TAG_4, createTabDrawable(R.drawable.settings), R.id.text_view_settings); }
Example #30
Source File: MainTabActivity.java From coolreader with MIT License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.tab_main); LocalActivityManager lam = new LocalActivityManager(this, true); lam.dispatchCreate(savedInstanceState); thMain = (TabHost)findViewById(android.R.id.tabhost); thMain.setup(lam); thMain.addTab(newTabSpec(TAB_BOOKSHELF, R.string.tab_bookshelf, R.drawable.tab_bookshelf, new Intent(this,BookshelfActivity.class))); thMain.addTab(newTabSpec(TAB_BOOKMARK, R.string.tab_bookmark, R.drawable.tab_bookmark, new Intent(this,BookmarkActivity.class))); thMain.addTab(newTabSpec(TAB_BOOK_ONLINE, R.string.tab_book_online, R.drawable.tab_book_online, new Intent(this,MainActivity.class))); rbtnBookshelf = (RadioButton)findViewById(R.id.radio_button0); rbtnbookmark = (RadioButton)findViewById(R.id.radio_button1); rbtnBookOnline = (RadioButton)findViewById(R.id.radio_button2); rbtnBookshelf.setOnCheckedChangeListener(this); rbtnbookmark.setOnCheckedChangeListener(this); rbtnBookOnline.setOnCheckedChangeListener(this); File file = new File("/mnt/sdcard/DotcoolReader"); if(!file.exists()){ file.mkdir(); } }