当前位置:网站首页>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
边栏推荐
- 环境配置篇
- 基于鲲鹏原生安全,打造安全可信的计算平台
- . Net ultimate productivity of efcore sub table sub database fully automated migration codefirst
- ACL 2022 | small sample ner of sequence annotation: dual tower Bert model integrating tag semantics
- 关于 appium 如何关闭 app (已解决)
- Practical example of propeller easydl: automatic scratch recognition of industrial parts
- 博文推荐|Apache Pulsar 跨地域复制方案选型实践
- HZOJ #236. 递归实现组合型枚举
- Creation and assignment of graphic objects
- Aosikang biological sprint scientific innovation board of Hillhouse Investment: annual revenue of 450million yuan, lost cooperation with kangxinuo
猜你喜欢
Talk about four cluster schemes of redis cache, and their advantages and disadvantages
HZOJ #240. 图形打印四
Importance of database security
Cookie
2022 polymerization process test question simulation test question bank and online simulation test
COSCon'22 社区召集令来啦!Open the World,邀请所有社区一起拥抱开源,打开新世界~
Day22 deadlock, thread communication, singleton mode
Sequoia China completed the new phase of $9billion fund raising
Image pixel read / write operation
高瓴投的澳斯康生物冲刺科创板:年营收4.5亿 丢掉与康希诺合作
随机推荐
【无标题】
Shortcut key of Bash
[untitled]
初学XML
聊聊Redis缓存4种集群方案、及优缺点对比
. Net ultimate productivity of efcore sub table sub database fully automated migration codefirst
云检测2020:用于高分辨率遥感图像中云检测的自注意力生成对抗网络Self-Attentive Generative Adversarial Network for Cloud Detection
《ASP.NET Core 6框架揭秘》样章[200页/5章]
Creation and assignment of graphic objects
【学习笔记】AGC010
认养一头牛冲刺A股:拟募资18.5亿 徐晓波持股近40%
.Net下極限生產力之efcore分錶分庫全自動化遷移CodeFirst
ClickHouse(03)ClickHouse怎么安装和部署
How to reset Firefox browser
详解ThinkPHP支持的URL模式有四种普通模式、PATHINFO、REWRITE和兼容模式
HZOJ #240. 图形打印四
基于鲲鹏原生安全,打造安全可信的计算平台
What are the benefits of ip2long?
MySQL master-slave replication
Four functions of opencv