Pouria Hemi
Pouria Hemi

Reputation: 735

How to create custom navigation drawer?

I want to create custom navigation drawer , but i have button and EditText in navigation . I use this to filter.but i cant create like this.

like this

Upvotes: 2

Views: 160

Answers (1)

Ashwini Saini
Ashwini Saini

Reputation: 1374

It's fairly easy to achieve customization

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


    <!--here is your navigation drawer just create what layout you want inside it-->

    <android.support.design.widget.NavigationView
        android:layout_width="wrap_content"
        android:layout_height="match_parent">

      <!--here you can create your custom view like this-->

          <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:orientation="vertical">


            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />


        </LinearLayout>


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

after that you can simply defined the ID same we do for other view and set onclicklistener on them to get click event

Upvotes: 4

Related Questions