Nakash.i
Nakash.i

Reputation: 381

Adding button below Navigation drawer

Im trying to bulid a Navigation drawer with buttons just below the "list" of items that it show from the menu folder. I tried to add linearLayout below it, but it just dont let me use the "free" space. the NavigationView height is "wrap_content".

activity main:

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:openDrawer="end">

    <include
        layout="@layout/app_bar_main"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:theme="@style/NavStyle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="end"
        android:layoutDirection="rtl"
        android:fitsSystemWindows="false"
        app:itemTextColor="@color/white"
        app:itemIconTint="@color/white"
        app:headerLayout="@layout/nav_header_main"
        android:background="@drawable/background_menu_bar"
        app:menu="@menu/activity_main_drawer"
        >
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:gravity="center_horizontal"
        >
        <Button
            android:id="@+id/android_rules_button"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/light_gray"
            android:textColor="@color/black"
            android:text="תקנון החברה"
            android:textSize="15dp"
            android:layout_marginTop="250dp"
            android:layout_marginStart="32dp"
            android:layout_marginEnd="32dp"/>

        <Button
            android:id="@+id/android1_about_button"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/light_gray"
            android:textColor="@color/black"
            android:text="אודותינו"
            android:textSize="15dp"
            android:layout_marginTop="266dp"
            android:layout_marginStart="32dp"
            android:layout_marginEnd="32dp"/>


    </LinearLayout>

    </android.support.design.widget.NavigationView>

</android.support.v4.widget.DrawerLayout>

this is how it looks: enter image description here

this is how it should look:

enter image description here

Thanks!

Upvotes: 1

Views: 1493

Answers (1)

Maya
Maya

Reputation: 369

In this case you should use Relative Layout for buttons.

Upvotes: 1

Related Questions