4
レイアウトxmlファイル内でのみタブレイアウトを定義できますか? Tabhostチュートリアルを見つけるたびに、いくつかの追加のJavaコードでしか動作しません。がTabHostの各タブを表しホルダークラスであるとして、コードなしでxmlファイル内にTabhost/TabWidget +コンテンツを定義することは可能ですか?
<?xml version="1.0" encoding="utf-8"?>
<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/linearLayout">
<TextView android:text="@string/app_name" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/textView1" android:textAppearance="?android:attr/textAppearanceLarge"></TextView>
<TabHost android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="match_parent">
<TabWidget android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@android:id/tabs">
</TabWidget>
<FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@android:id/tabcontent">
<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab1">
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="TAB 1"/>
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab2">
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="TAB 2"/>
</LinearLayout>
</FrameLayout>
</TabHost>
</LinearLayout>