我在Android的PageViewer中重疊片段。片段在ViewPager中重疊
PFB我對PageViewer
<TabHost
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="900dp"
android:layout_alignParentBottom="true" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@android:id/tabs" >
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
</android.support.v4.view.ViewPager>
</FrameLayout>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal" >
</TabWidget>
</RelativeLayout>
</TabHost>
佈局我通過第一個選項卡的我的第一塊碎片說FragmentA調用它。我需要片段A1 調用這個從列表中單擊按鈕從BaseAdapter
Fragment duedateFrag = new FieldVisitFragment();
FragmentTransaction ft = fragmentActivity.getSupportFragmentManager().beginTransaction();
ft.replace(android.R.id.tabcontent, duedateFrag);
ft.commit();
我的片段被調用但其對viewpager重疊來取代它。 選項卡從新片段下面運行。善意幫助
事後看來,我認爲某處嵌套片段或兒童片段應該發揮作用。請指導。
你有什麼用「的FrameLayout」和「android.support.v4.view.ViewPager」做都是你的情況不同的正確 –
我有4個選項卡,並與viewPager我我滾動這些標籤 –
在每個標籤上我有單獨的片段顯示爲每個標籤 –