Android UI 之侧滑抽屉菜单(一)——DrawerLayout + NavigationView

本文介绍了Android 5.0后自带的 DrawerLayout 和 NavigationView 结合使用来实现侧滑抽屉菜单的方法,包括XML布局、属性设置和注意事项。提供了一个简单的侧滑菜单效果图,并给出了相关代码参考及下载链接。
摘要由CSDN通过智能技术生成

本文出自:http://blog.csdn.net/dt235201314/article/details/78962509

一丶概述

Android侧滑效果实现有很多种,这里先说说,Android系统5.0后自带的DrawerLayout + NavigationView。

二丶效果图


三丶看代码

DrawerLayout + NavigationView  xml布局

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/blue_bg">

            <com.example.jinboy.codertodeveloperbytcler.java_demo.appdemo.ui.view.CircleImageView
                android:id="@+id/iv_mine_avatar"
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:layout_marginTop="5dp"
                android:layout_marginBottom="5dp"
                android:layout_below="@+id/title_bar"
                android:layout_marginStart="10dp"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值