我有一個導航抽屜列表,其中我已經放置了某些項目,如配置文件,插入等等。每個項目對應一個片段。現在我不想把註銷按鈕,但我想把它放在導航抽屜列表的下面。因爲它只是做註銷用戶的工作,並且我的應用程序不需要用戶交互。我希望該用戶單擊註銷和他/她的日誌所以我想把註銷按鈕分開放在列表下面。 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"
android:background="@android:color/white">
<!-- Framelayout to display Fragments -->
<FrameLayout
android:id="@+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:id="@+id/drawerLL1"
android:layout_width="40dp"
android:layout_height="200dp"
android:background="@color/list_background"
>
<!-- 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"
/>
<Button
android:id="@+id/drawerButton1"
android:layout_width="40dp"
android:height="200dp"
/>
</android.support.v4.widget.DrawerLayout>
所以第二個孩子,把一個有。抽屜不一定是一個ListView,或RecyclerView,或任何你在那裏。它可以是一個垂直的LinearLayout,其頂部有一個ListView,下面是一個Button。 –
如何以編程方式連接它們。請給我提供例子嗎? – user2866916