activity.java
package com.android.test.login;
import android.app.Activity;
import android.app.TabActivity;
import android.media.ThumbnailUtils;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.widget.TabHost;
public class TestActivity extends TabActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TabHost tabHost = getTabHost();
LayoutInflater.from(this).inflate(R.layout.tabs1, tabHost.getTabContentView(), true);
tabHost.addTab(tabHost.newTabSpec("tab12")
.setIndicator("tab11")
.setContent(R.id.view1));
tabHost.addTab(tabHost.newTabSpec("tab23")
.setIndicator("tab22")
.setContent(R.id.view2));
tabHost.addTab(tabHost.newTabSpec("tab33")
.setIndicator("tab34")
.setContent(R.id.view3));
}
}
tabs1.xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView android:id="@+id/view1"
android:background="#221122"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="sun6223508@gmail.com"/>
<TextView android:id="@+id/view2"
android:background="#ff11aa"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="sun6223508@gmail.com"/>
<TextView android:id="@+id/view3"
android:background="#ff1122"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="sun6223508@gmail.com"/>
</FrameLayout>