答案 0 :(得分:2)
实现定制相当容易
<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>
之后,您可以像其他视图一样简单地定义ID,并在其上设置onclicklistener
以获得点击事件