当前位置:网站首页>短视频平台开发,依靠DrawerLayout实现侧滑菜单效果
短视频平台开发,依靠DrawerLayout实现侧滑菜单效果
2022-07-01 00:42:00 【云豹网络科技】
短视频平台开发,依靠DrawerLayout实现侧滑菜单效果
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"
tools:openDrawer="start">
<!-- 右边视图 -->
<include
layout="@layout/app_bar_main"
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_main"
app:menu="@menu/activity_main_drawer" />
</android.support.v4.widget.DrawerLayout>
然后在res文件夹里面添加一个menu菜单文件夹,已经添加的就不用添加了
上面的代码里面NavigationView里面有个 app:menu=”@menu/activity_main_drawer”对应如下:
添加一个菜单文件,名字随意,我的是activity_main_drawer.xml
activity_main_drawer.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group android:checkableBehavior="single">
<item
android:id="@+id/nav_camera"
android:icon="@drawable/ic_menu_camera"
android:title="第一行" />
<item
android:id="@+id/nav_gallery"
android:icon="@drawable/ic_menu_gallery"
android:title="第二行" />
<item
android:id="@+id/nav_slideshow"
android:icon="@drawable/ic_menu_slideshow"
android:title="第三行" />
<item
android:id="@+id/nav_manage"
android:icon="@drawable/ic_menu_manage"
android:title="第四行" />
</group>
<item android:title="Communicate">
<menu>
<item
android:id="@+id/nav_share"
android:icon="@drawable/ic_menu_share"
android:title="第五行" />
<item
android:id="@+id/nav_send"
android:icon="@drawable/ic_menu_send"
android:title="第六行" />
</menu>
</item>
</menu>
以上就是 短视频平台开发,依靠DrawerLayout实现侧滑菜单效果,更多内容欢迎关注之后的文章
边栏推荐
- Koa koa combine routes sub route management
- Inspire students' diversified thinking with steam Education
- Uniapp official component clicking item is invalid, solution
- Parity linked list [two general directions of linked list operation]
- Kongyiji's first question: how much do you know about service communication?
- 分割链表[先取next再斩断链表防止断链]
- 微生物安全与健康,什么是生物处理?
- Typora的使用
- 编译安装oh-my-zsh
- Matlab farthest point sampling (FPS improved version)
猜你喜欢

一站式洞察行业热点,飞瓜数据B站新功能「流量大盘」上线!

uniapp官方组件点击item无效,解决方案

For the first time in more than 20 years! CVPR best student thesis awarded to Chinese college students!

图的连通性基础

农产品换房?“变相”购房补贴!

Call the classic architecture and build the model based on the classic

基础知识之三——标准单元库

数字IC设计流程总结

流批一体在京东的探索与实践

用recyclerReview展示Banner,很简单
随机推荐
Basic knowledge of software and hardware -- diary (1)
Pytorch programming knowledge (2)
流批一体在京东的探索与实践
Kongyiji's first question: how much do you know about service communication?
Applet Custom Grid
45岁程序员告诉你:程序员为什么要跳槽,太真实...
迪赛智慧数——其他图表(平行坐标图):2021年应届专业就业情况
Digital IC design process summary
微生物检测,土壤微生物的作用有哪些?
Solve idea:class' xxx 'not found in module' xxx‘
[problem handled] -nvidia SMI command cannot obtain the GPU process number of its own container and the external GPU process number
Exploration and practice of "flow batch integration" in JD
基础知识之一——STA基础概述
图灵奖得主LeCun指明AI未来的出路在于自主学习,这家公司已踏上征途
System settings large page
【队列】933. Number of Recent Calls
[learning notes] simple DP
[leetcode] sum of two numbers [1]
flutter报错 -- The argument type ‘Function‘ can‘t be assigned to the parameter type ‘void Function()?‘
【模拟】922. Sort Array By Parity II