DrawerLayout
来源:互联网 发布:abb编程培训 编辑:程序博客网 时间:2024/05/18 00:54
DrawerLayout是Support Library包中实现了侧滑菜单效果的控件。今天才发现使用起来这么简单。先看效果
再看代码:
只需要在根布局写成DrawerLayout就行,因为他本身就带有滑动的效果
<?xml version="1.0" encoding="utf-8"?><android.support.v4.widget.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.example.drawerlayout.MainActivity"> <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:text="Hello World!" /> </FrameLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="start" android:background="@color/colorPrimary" android:orientation="vertical"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="策略1" android:textColor="#ff0" android:textSize="30sp" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="策略2" android:textColor="#f00" android:textSize="30sp" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="策略3" android:textColor="#0f0" android:textSize="30sp" /> </LinearLayout></android.support.v4.widget.DrawerLayout>
阅读全文
0 0
- DrawerLayout
- DrawerLayout
- DrawerLayout
- DrawerLayout
- DrawerLayout
- DrawerLayout
- DrawerLayout
- drawerLayout
- DrawerLayout
- DrawerLayout
- DrawerLayout
- DrawerLayout
- DrawerLayout
- DrawerLayout
- drawerLayout
- DrawerLayout
- DrawerLayout
- DrawerLayout
- 基于OpenCV的视频图像组态 (7) :轮子动画效果
- 友盟新浪分享报错SSLSocket
- 编写高质量代码:改善java程序的151个建议
- 小程序模板消息错误码41030,invalid page hint: [gP1eXXXXXX]解决方法
- android:clipChildren的意思及其用法
- DrawerLayout
- Django项目中创建前端Vue.js项目的步骤
- Java校招面试 Google面试官亲授
- 使用阿里ARouter路由实现模块化开发流程
- centos7服务安装_流媒体服务器_安装nginx
- C#串口上位机源代码
- FlexboxLayout选中之——单选/多选
- ubuntu16.04环境用pip3安装dlib
- struts2-hibernate 总结