STEP BY STEP
<LinearLayout
xmlns:android=”http://schemas.android.com/apk/res/android”
android:orientation=”vertical”
android:layout_width=”fill_parent”
android:layout_height=”fill_parent”>
android:id=”@+id/tabhost”
android:layout_width=”fill_parent”
android:layout_height=”fill_parent”>
android:id=”@android:id/tabs”
android:layout_width=”fill_parent”
android:layout_height=”wrap_content”/>
android:id=”@android:id/tabcontent”
android:layout_width=”fill_parent”
android:layout_height=”fill_parent”
android:paddingTop=”62px”>
android:id=”@+id/tab1″
android:layout_width=”fill_parent”
android:layout_height=”fill_parent”
android:layout_centerHorizontal=”true”/>
android:id=”@+id/digitalClock1″
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:text=”DigitalClock”
android:layout_gravity=”center”/>
</TabHost>
</LinearLayout>
import android.os.Bundle;
import android.widget.TabHost;
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tabs.setup();
TabHost.TabSpec spec=tabs.newTabSpec(“tag1″);
spec.setContent(R.id.tab1);
spec.setIndicator(“Analog Clock”);
tabs.addTab(spec);
spec=tabs.newTabSpec(“tag2″);
spec.setContent(R.id.digitalClock1);
spec.setIndicator(“Digital Clock”);
tabs.addTab(spec);
tabs.setCurrentTab(0);
}

Post a Comment
Click to see the code!
To insert emoticon you must added at least one space before the code.