Back to project page Android-ActionBarSherlock-FragmentTabHost-Tutorial.
The source code is released under:
Apache License
If you think the Android project Android-ActionBarSherlock-FragmentTabHost-Tutorial listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.androidbegin.absfragtabhost; /* w ww . j a v a 2 s. c o m*/ import com.actionbarsherlock.app.SherlockFragmentActivity; import android.support.v4.app.FragmentTabHost; import android.os.Bundle; public class MainActivity extends SherlockFragmentActivity { // Declare Variables private FragmentTabHost mTabHost; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Set the view from main_fragment.xml setContentView(R.layout.main_fragment); // Locate android.R.id.tabhost in main_fragment.xml mTabHost = (FragmentTabHost) findViewById(android.R.id.tabhost); // Create the tabs in main_fragment.xml mTabHost.setup(this, getSupportFragmentManager(), R.id.tabcontent); // Create Tab1 with a custom image in res folder mTabHost.addTab(mTabHost.newTabSpec("tab1").setIndicator("", getResources().getDrawable(R.drawable.tab1)), FragmentTab1.class, null); // Create Tab2 mTabHost.addTab(mTabHost.newTabSpec("tab2").setIndicator("Tab2"), FragmentTab2.class, null); // Create Tab3 mTabHost.addTab(mTabHost.newTabSpec("tab3").setIndicator("Tab3"), FragmentTab3.class, null); } }