Android 笔记 CoordinatorLayout

本文深入解析Android官方提供的抽屉布局实现方式,通过XML文件展示如何构建包含底层布局和抽屉导航视图的完整布局结构,提供实现步骤和关键代码片段。
  • CoordinatorLayout

Android 官方 抽屉布局

截取官方例子中布局代码

include的布局为底层布局

后面navigationview 为抽屉,即拉出来的那一层

<?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:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true" 
    tools:openDrawer="start">

    <include layout="@layout/app_bar_mao"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <android.support.design.widget.NavigationView
         android:id="@+id/nav_view"
         android:layout_width="wrap_content"
         android:layout_height="match_parent"
         android:layout_gravity="start" 
         android:fitsSystemWindows="true"
         app:headerLayout="@layout/nav_header_mao"   
         app:menu="@menu/activity_mao_drawer" />

</android.support.v4.widget.DrawerLayout>

12
2为抽屉效果

更多详细

http://blog.youkuaiyun.com/xyz_lmn/article/details/48055919

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值