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.
- whats the problem in creating it ? Navigation drawer is also a view and you can use any view subclass with itVivek Mishra– Vivek Mishra2018-09-23 08:46:13 +00:00Commented Sep 23, 2018 at 8:46
- i can use editText and button in menu>"my xml"Pouria Hemi– Pouria Hemi2018-09-23 08:49:03 +00:00Commented Sep 23, 2018 at 8:49
- 2You can use normal layout xml in navigation drawer too. Its not mandatory to usemenu.xmlVivek Mishra– Vivek Mishra2018-09-23 08:50:02 +00:00Commented Sep 23, 2018 at 8:50
Add a comment |
1 Answer
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
