当前位置:网站首页>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
边栏推荐
- How to apply @transactional transaction annotation to perfection?
- 国泰君安证券开户怎么开的?开户安全吗?
- ICLR 2022 | pre training language model based on anti self attention mechanism
- API query interface for free mobile phone number ownership
- 【学习笔记】AGC010
- [difficult and miscellaneous]pip running suddenly appears modulenotfounderror: no module named 'pip‘
- The URL modes supported by ThinkPHP include four common modes, pathinfo, rewrite and compatibility modes
- 聊聊Redis缓存4种集群方案、及优缺点对比
- Conversion from non partitioned table to partitioned table and precautions
- Creation and assignment of graphic objects
猜你喜欢

为租客提供帮助

飞桨EasyDL实操范例:工业零件划痕自动识别

. Net ultimate productivity of efcore sub table sub database fully automated migration codefirst

Adopt a cow to sprint A shares: it plans to raise 1.85 billion yuan, and Xu Xiaobo holds nearly 40%

明星企业普渡科技大裁员:曾募资超10亿 腾讯红杉是股东

处理链中断后如何继续/子链出错removed from scheduling

滑轨步进电机调试(全国海洋航行器大赛)(STM32主控)

Creation and assignment of graphic objects

Smart cloud health listed: with a market value of HK $15billion, SIG Jingwei and Jingxin fund are shareholders

Image pixel read / write operation
随机推荐
Aosikang biological sprint scientific innovation board of Hillhouse Investment: annual revenue of 450million yuan, lost cooperation with kangxinuo
关于 appium 如何关闭 app (已解决)
Practical case: using MYCAT to realize read-write separation of MySQL
HZOJ #236. 递归实现组合型枚举
ISPRS2021/遥感影像云检测:一种地理信息驱动的方法和一种新的大规模遥感云/雪检测数据集
Users, groups, and permissions
Steps of building SSM framework
云检测2020:用于高分辨率遥感图像中云检测的自注意力生成对抗网络Self-Attentive Generative Adversarial Network for Cloud Detection
MySQL importing SQL files and common commands
Layer pop-up layer closing problem
MySQL master-slave replication
How to apply @transactional transaction annotation to perfection?
layer弹出层的关闭问题
Go language learning notes - structure
Day-15 common APIs and exception mechanisms
Adopt a cow to sprint A shares: it plans to raise 1.85 billion yuan, and Xu Xiaobo holds nearly 40%
Leetcode question brushing: binary tree 26 (insertion operation in binary search tree)
谷歌浏览器如何重置?谷歌浏览器恢复默认设置?
@Resource和@Autowired的区别?
Leetcode skimming: binary tree 27 (delete nodes in the binary search tree)