【发布时间】:2012-09-07 13:10:28
【问题描述】:
我是 Android 中 Fragment 的新手,我指的是 Fragments 演示示例提供了 supprotv4 兼容性库。
谁能解释为什么在 Android Support4Demos 的 FragmentTabs.java 示例中有两个框架布局 (@+android:id/realtabcontent , @android:id/tabcontent)。
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>
提前致谢
【问题讨论】:
标签: android android-layout android-fragments android-framelayout