4
我是Android中的新片段,我指的是片段演示示例为supprotv4兼容性库提供的。Android支持FragmentTabs示例中的两个框架布局支持4Demos
任何人都可以解释为什么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>
在此先感谢