我在一个项目中单独使用了滑动菜单并单独使用了选项卡,但我未能将它们组合在一个项目中.. 有人遇到过这个问题吗?提前致谢
问问题
976 次
2 回答
0
您可以使用滑动菜单中的选项卡。您应该将具有选项卡的布局放在滑动菜单的第二个子项中。
<android.support.v4.widget.SlidingPaneLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/sliding_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:id="@+id/drawer_relative"
android:layout_width="280dp"
android:layout_height="match_parent"
android:layout_gravity="left" >
<FrameLayout
android:id="@+id/list_fragment_id"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>
</RelativeLayout>
<android.support.v4.app.FragmentTabHost
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" >
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0" />
<FrameLayout
android:id="@+id/realtabcontent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:orientation="horizontal"
android:showDividers="none" />
</LinearLayout>
</android.support.v4.app.FragmentTabHost>
于 2014-03-31T07:07:17.957 回答
0
只需使用这个惊人的类:) http://developer.android.com/samples/SlidingTabsBasic/src/com.example.android.common/view/SlidingTabLayout.html
于 2014-05-22T11:19:05.183 回答