최대 1 분 소요

<?xml version=”1.0” encoding=”utf-8”?>

<TabHost xmlns:android=”http://schemas.android.com/apk/res/android”

android:id=”@android:id/tabhost”

android:layout_width=”fill_parent”

android:layout_height=”fill_parent”>

<LinearLayout

android:orientation=”vertical”

android:layout_width=”fill_parent”

android:layout_height=”fill_parent”>

<FrameLayout

android:layout_weight=”1”

android:id=”@android:id/tabcontent”

android:layout_width=”fill_parent”

android:layout_height=”fill_parent”>

<AnalogClock

android:id=”@+id/AnalogClock01”

android:layout_width=”fill_parent”

android:layout_height=”fill_parent”

/>

<DigitalClock

android:id=”@+id/DigitalClock01”

android:layout_width=”fill_parent”

android:layout_height=”fill_parent”

android:textSize=”50dp”

android:gravity=”center”

/>

</FrameLayout>

<TabWidget

android:id=”@android:id/tabs”

android:layout_width=”fill_parent”

android:layout_height=”wrap_content”/>

</LinearLayout>

</TabHost>


package com.hardrock.hellotest;

import android.app.TabActivity;

import android.os.Bundle;

import android.widget.TabHost;

public class HelloTestActivity extends TabActivity {

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

TabHost mTabHost = getTabHost();

mTabHost.addTab(mTabHost.newTabSpec(“tab_test1”)

.setIndicator(“아날로그 시계”)

.setContent(R.id.AnalogClock01));

mTabHost.addTab(mTabHost.newTabSpec(“tab_test2”)

.setIndicator(“디지털 시계”)

.setContent(R.id.DigitalClock01));

mTabHost.setCurrentTab(0);

}

}

\