Android Material Design 之 DrawLayout
2020-02-17 04:47
323 查看
Drawlayout
DrawerLayout 最好放在根布局,DrawerLayout之下有两个子布局,一个是FramLayout和TextView
第一个子布局则是主界面布局,第二个子布局则是侧滑的菜单界面
<?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout android:id="@+id/drawerlayout" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.us.androiddesign.drawerLayout.DrawerLayoutActivity"> <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="@android:color/holo_green_light" android:theme="@style/Theme.AppCompat.Light.NoActionBar" app:popupTheme="@style/ThemeOverlay.AppCompat"> </android.support.v7.widget.Toolbar> </FrameLayout> <TextView <!--第二个子布局可以选择其他的,比如ListView等--> android:id="@+id/chehua" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#fff" android:layout_gravity="start" <!--这里特别注意这个属性必须要,否则侧滑菜单用不了--> android:text="这是一个侧滑菜单1"/> </android.support.v4.widget.DrawerLayout>
转载于:https://my.oschina.net/quTMD/blog/1551363
- 点赞
- 收藏
- 分享
- 文章举报
相关文章推荐
- Android studio抓取app应用日志
- Android 夜间模式的实现
- Android中会引起ANR的情况
- Android 底部地址选择弹框
- vim调试android项目脚本完成
- android 两端对齐
- 就大神帮忙看一下Android自动挂断电话功能,测试了好久,就是不能自动挂断。
- android图标尺寸
- 面试Android实习生岗位的一些问题
- Android打包aar后private可见性变public的问题及解决
- android studio打正式包报错Cause: unable to find valid certification path to requested target
- android中群发短信PendingIntent.getBroadcase的注册广播
- Android滚动显示数字动画
- 支付密码弹出框 Android
- Android 沉浸式状态栏(透明)适配
- Installing Android Studio
- Android Permission
- Android尺寸,DP,PX
- 记录编译Android7.1源码jack ERROR
- [rk3288][android-5.1]通过prop属性设定camera orientation