4

私は Android のフラグメントを初めて使用し、supprotv4 互換性ライブラリを提供する Fragments のデモ例を参照しています。

(@+android:id/realtabcontent , @android:id/tabcontent)Android Support4Demos の FragmentTabs.java の例に2 つのフレーム レイアウトがある理由を誰でも説明できますか。

FragmentTabs.java 呼び出しsetContentView(R.layout.fragment_tabs);メソッドと、以下は同じレイアウト ファイルです。

fragment_tabs.xml

    <TabHost xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@android:id/tabhost"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >

            <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="0"
                android:orientation="horizontal" />

            <FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:layout_weight="0" />

            <FrameLayout
                android:id="@+android:id/realtabcontent"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1" />
        </LinearLayout>

    </TabHost>

前もって感謝します

4

1 に答える 1