本文出自:http://blog.csdn.net/dt235201314/article/details/78962509
一丶概述
Android侧滑效果实现有很多种,这里先说说,Android系统5.0后自带的DrawerLayout + NavigationView。
二丶效果图
三丶看代码
DrawerLayout + NavigationView xml布局
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/blue_bg"> <com.example.jinboy.codertodeveloperbytcler.java_demo.appdemo.ui.view.CircleImageView android:id="@+id/iv_mine_avatar" android:layout_width="50dp" android:layout_height="50dp" android:layout_marginTop="5dp" android:layout_marginBottom="5dp" android:layout_below="@+id/title_bar" android:layout_marginStart="10dp"