DrawerLayout结合结合Tollbar实现菜单侧滑效果实现菜单侧滑效果
主要为大家详细介绍了DrawerLayout结合Tollbar实现菜单侧滑效果,具有一定的参考价值,感兴趣的小伙伴们
可以参考一下
本文实例为大家分享了DrawerLayout结合Tollbar实现菜单侧滑的具体代码,供大家参考,具体内容如下
DrawerLayout(抽屉布局):谷歌官方的控件,可以简单的实现侧滑菜单;
此Demo主要是DrawerLayout结合Toolbar实现侧滑左上角返回键实现动画效果,点击左上角返回键实现动画效果并且滑出滑
入侧滑菜单;
xml布局文件:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="www.dld.com.drawerlayoutdemo.MainActivity"
android:orientation="vertical">
<!--app:theme="@style/DrawerArrowStyle"设置旋转样式(当DrawerLayout滑出返回键有一个动画)-->
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/toolbar"
android:background="@android:color/holo_blue_dark"
app:theme="@style/DrawerArrowStyle"/>
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--主布局-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#e5e5e5">
评论0
最新资源