2

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

3
  • whats the problem in creating it ? Navigation drawer is also a view and you can use any view subclass with it Commented Sep 23, 2018 at 8:46
  • i can use editText and button in menu>"my xml" Commented Sep 23, 2018 at 8:49
  • 2
    You can use normal layout xml in navigation drawer too. Its not mandatory to usemenu.xml Commented Sep 23, 2018 at 8:50

1 Answer 1

4

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.