当前位置:网站首页>DrawerLayout禁止侧滑显示
DrawerLayout禁止侧滑显示
2022-07-07 11:04:00 【今人不见古时月,今月曾经照古人】
说明:
安卓DrawerLayout有时候不需要侧滑显示,这个时候就需要禁止侧滑动作。
只需要一行代码。
代码:
// 禁止手势滑动
drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
//打开手势滑动
mDrawer_layout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED)
在初始化加入以下即可:
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
toggle.syncState();
————————————————
转载于:https://blog.csdn.net/u012246458/article/details/80162799
边栏推荐
- 人均瑞数系列,瑞数 4 代 JS 逆向分析
- .Net下极限生产力之efcore分表分库全自动化迁移CodeFirst
- 《ASP.NET Core 6框架揭秘》样章[200页/5章]
- Creation and assignment of graphic objects
- Day-19 IO stream
- 有什么类方法或是函数可以查看某个项目的Laravel版本的?
- 聊聊Redis缓存4种集群方案、及优缺点对比
- Sample chapter of "uncover the secrets of asp.net core 6 framework" [200 pages /5 chapters]
- Leetcode skimming: binary tree 22 (minimum absolute difference of binary search tree)
- 2022 examination questions and online simulation examination for safety production management personnel of hazardous chemical production units
猜你喜欢
云检测2020:用于高分辨率遥感图像中云检测的自注意力生成对抗网络Self-Attentive Generative Adversarial Network for Cloud Detection
如何将 @Transactional 事务注解运用到炉火纯青?
基于鲲鹏原生安全,打造安全可信的计算平台
2022a special equipment related management (boiler, pressure vessel and pressure pipeline) simulated examination question bank simulated examination platform operation
Adopt a cow to sprint A shares: it plans to raise 1.85 billion yuan, and Xu Xiaobo holds nearly 40%
关于 appium 启动 app 后闪退的问题 - (已解决)
Image pixel read / write operation
Leetcode skimming: binary tree 27 (delete nodes in the binary search tree)
Four functions of opencv
Go语言学习笔记-结构体(Struct)
随机推荐
事务的七种传播行为
Day-19 IO stream
认养一头牛冲刺A股:拟募资18.5亿 徐晓波持股近40%
【无标题】
初学XML
HZOJ #236. 递归实现组合型枚举
DHCP 动态主机设置协议 分析
2022 examination questions and online simulation examination for safety production management personnel of hazardous chemical production units
Sequoia China completed the new phase of $9billion fund raising
Day-18 hash table, generic
test
《开源圆桌派》第十一期“冰与火之歌”——如何平衡开源与安全间的天然矛盾?
Leetcode brush questions: binary tree 19 (merge binary tree)
Importance of database security
怎样重置火狐浏览器
. Net ultimate productivity of efcore sub table sub database fully automated migration codefirst
滑轨步进电机调试(全国海洋航行器大赛)(STM32主控)
Conversion from non partitioned table to partitioned table and precautions
MySQL导入SQL文件及常用命令
Shortcut key of Bash