drawerLayout简单用法
16lz
2021-01-23
<?xml version="1.0" encoding="utf-8"?> <androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"><!--第一个view为显示的控件--> <LinearLayout android:layout_width="150dp" android:layout_height="match_parent" > <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/ic_launcher_round" android:layout_gravity="center"/> </LinearLayout> <!--第二个view为滑动显示的控件--> <!--android:layout_gravity="left" 设置为left就是左滑动,right就是右滑过--> <LinearLayout android:background="@color/colorPrimaryDark" android:layout_width="150dp" android:layout_height="match_parent" android:layout_gravity="left" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="left menu"/> </LinearLayout> <!--android:layout_gravity="left" 不设置为主体内容--> <LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" > <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="123"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="123"/> </LinearLayout></androidx.drawerlayout.widget.DrawerLayout>
更多相关文章
- Android学习之自定义控件之图片带文字的View
- Android注解式绑定控件,没你想象的那么难
- 自定义实现类似android主界面的滑屏换屏控件
- Android界面设计基础:控件焦点4个步骤
- android 开发零起步学习笔记(九):android 控制控件的位置和大小及L
- 一起写一个Android图片轮播控件
- Android中自定义控件的步骤
- Android 动态增加控件