【发布时间】:2014-01-05 22:35:54
【问题描述】:
首先我是 android 新手,很抱歉不清楚点,我有 2 个布局:第一个包含片段;第二个是导航抽屉布局。
如何将两种布局整合到一个布局中?我想让主布局包含两种布局,请帮忙..
第一个布局:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<fragment android:name="com.example.HomeFragment"
android:id="@+id/selectionFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<fragment android:name="com.example.SplashFragment"
android:id="@+id/splashFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<fragment android:name="com.facebook.widget.UserSettingsFragment"
android:id="@+id/userSettingsFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
第二个导航抽屉布局:
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Framelayout to display Fragments -->
<FrameLayout
android:id="@+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- Listview to display slider menu -->
<ListView
android:id="@+id/list_slidermenu"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="@color/list_divider"
android:dividerHeight="1dp"
android:listSelector="@drawable/list_selector"
android:background="@color/list_background"/>
</android.support.v4.widget.DrawerLayout>
【问题讨论】:
标签: android android-layout layout android-fragments navigation-drawer