在其他活动中重复使用活动

时间:2013-09-25 14:21:37

标签: android android-activity fragment

我已经实现了导航抽屉。我创建了单独的XML以及单独的Activity。现在我想在不同的活动中使用该Activity。所以我们可以说我想在不同的活动中使用相同的导航抽屉。所以我可以通过在不同的活动中膨胀相同的代码和视图来减少我的代码。

我的xml代码如下所示:

<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">


    <include layout="@layout/layout_map"/>

    <FrameLayout
        android:id="@+id/content_frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <ListView
        android:id="@+id/left_drawer"
        android:layout_width="240dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:choiceMode="singleChoice"
        android:divider="#4a4a4c"
        android:dividerHeight="1dp"
        android:background="#393839"/>
</android.support.v4.widget.DrawerLayout>

我需要你的帮助才能尽快实现这一目标。

由于

0 个答案:

没有答案