NavigationView(导航抽屉)做一个简单的侧滑菜单

这篇博客记录了一位Android实习生如何使用NavigationView创建简单的侧滑菜单。内容包括布局设置、menu.xml配置、头部和菜单栏的添加,以及在MainActivity中实现滑动效果和点击反馈。博主分享了完整代码,并欢迎读者提出建议。
摘要由CSDN通过智能技术生成

NavigationView(导航抽屉)做一个简单的侧滑菜单

自己学习的一些小项目,记录在博客里面。有不足之处希望各位大佬指正!!!

运行效果:
实现效果

1.activity_main.xml布局如下:

<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"

    android:background="#fffff0"

    tools:openDrawer="start">

  <TextView

      android:textSize="20dp"

     android:id="@+id/main"

      android:layout_width="wrap_content"

      android:layout_height="wrap_content"

      android:text="这是一个主界面!!!"/>

    <android.support.design.widget.NavigationView

        android:layout_gravity="left"

        app:headerLayout="@layout/head"

        app:menu="@menu/menu"

        android:id="@+id/navi"

        android:layout_width="wrap_conte
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值