当前位置:网站首页>短视频平台开发,依靠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实现侧滑菜单效果,更多内容欢迎关注之后的文章
边栏推荐
- visual studio 2019 下载
- 农产品换房?“变相”购房补贴!
- 6月第4周榜单丨飞瓜数据UP主成长排行榜(哔哩哔哩平台)发布!
- TypeError: Argument ‘angle‘ can not be treated as a double
- Typora的使用
- (learning power + thinking power) x action power, summary of flywheel effect on the growth of technicians
- Visual studio 2019 Download
- 【Qt5-基础篇_1】从0开始,德天老师和你一起学习——窗口简介
- [go] go implements row column conversion of sets
- Parity linked list [two general directions of linked list operation]
猜你喜欢

Opencv basic operation 2 realizes label2rgb and converts gray-scale images into color images

DC學習筆記正式篇之零——綜述與基本流程介紹

Uniapp official component clicking item is invalid, solution
![[问题已处理]-nvidia-smi命令获取不到自身容器的GPU进程和外部的GPU进程号](/img/51/e48e222c14f4a4e9f2be91a677033f.png)
[问题已处理]-nvidia-smi命令获取不到自身容器的GPU进程和外部的GPU进程号

Docker deployment MySQL 8

元宇宙为 VR/AR 带来的新机会

Windows环境下安装MongoDB数据库

gin 配置文件

Win11安装redis 数据库以及redis desktop manager的下载
![[learning notes] structure](/img/55/9623ba97f57eff71c246684e3a2bba.png)
[learning notes] structure
随机推荐
機器人編程的培訓學科類原理
Construction and beautification of personal blog
Openmv and k210 of the f question of the 2021 video game call the openmv API for line patrol, which is completely open source.
Visual studio 2019 shortcut notes
neo4j安装、运行以及项目的构建和功能实现
System settings large page
Exploration and practice of "flow batch integration" in JD
Typora的使用
Q play soft large toast to bring more comfortable sleep
[learning notes] double + two points
User defined annotation implementation verification
mysql插入\更新前+判断条件
About the general input operation mode of unity
Basic knowledge 3 - standard unit library
Use of typora
sort自定义函数
Service grid ASM year end summary: how do end users use the service grid?
StrictMode分析Activity泄漏-StrictMode原理(3)
QT5-布局在创作中的理解应用
流批一体在京东的探索与实践