Recently in the study of the Sideslip menu found some problems, if you have not contacted before will certainly go to Baidu, and I have seen a lot of demo, I believe you see examples are the following layout of the
Headerlayout Load header layout, menu loading menus, so that the composition of a complete menu, then the problem, menu click events posted online, very simple, then the head? You may not be able to start, then only look at the source code, Navigationview in the Inflateheaderview this method, see this method you will certainly feel that is through this method load head layout, well, now the method has, But when you load this method, you'll notice that there are two header layouts in the menu, is obviously loaded two times, the first time is in the layout file specified in the Headerlayout, when you slide the menu will load the header layout, the second time you are in the code again loaded. So there are two layouts. Just delete the headerlayout line of code in the layout to achieve the effect you want. The code to bind the header layout is given below
Layout file
<android.support.design.widget.nacigationview
Android:layout_width= "Wrap_content"
android:layout_height= "Match_parent"
Andriod:layout_gravity= "Start"
app:headerlayout= "@layout/drawer_header"
app:menu= "@menu/drawer"/>
Bound sideslip Menu Headerlayout layout,
View Drawview = Nav_view.inflateheaderview (R.layout.view_leftmenu);
ImageView user_pic = (imageview) Drawview.findviewbyid (r.id.imag_user_pic);
The problem can be resolved by Navigationview to load the header layout and then control binding.