当前位置:网站首页>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
边栏推荐
- @Resource和@Autowired的区别?
- Differences between MySQL storage engine MyISAM and InnoDB
- PHP调用纯真IP数据库返回具体地址
- . Net ultimate productivity of efcore sub table sub database fully automated migration codefirst
- .Net下极限生产力之efcore分表分库全自动化迁移CodeFirst
- Aosikang biological sprint scientific innovation board of Hillhouse Investment: annual revenue of 450million yuan, lost cooperation with kangxinuo
- 为租客提供帮助
- 基于NeRF的三维内容生成
- 3D content generation based on nerf
- Cmu15445 (fall 2019) project 2 - hash table details
猜你喜欢

- Oui. Migration entièrement automatisée de la Sous - base de données des tableaux d'effets sous net

Sed of three swordsmen in text processing

博文推荐|Apache Pulsar 跨地域复制方案选型实践

TPG x AIDU|AI领军人才招募计划进行中!

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

《开源圆桌派》第十一期“冰与火之歌”——如何平衡开源与安全间的天然矛盾?

Visual stdio 2017 about the environment configuration of opencv4.1

Practical example of propeller easydl: automatic scratch recognition of industrial parts

COSCon'22 社区召集令来啦!Open the World,邀请所有社区一起拥抱开源,打开新世界~

【学习笔记】AGC010
随机推荐
Enterprise custom form engine solution (XII) -- experience code directory structure
Talk about four cluster schemes of redis cache, and their advantages and disadvantages
[learn microservices from 0] [03] explore the microservice architecture
How to apply @transactional transaction annotation to perfection?
File operation command
Leetcode skimming: binary tree 21 (verifying binary search tree)
MySQL importing SQL files and common commands
红杉中国完成新一期90亿美元基金募集
高瓴投的澳斯康生物冲刺科创板:年营收4.5亿 丢掉与康希诺合作
测试下摘要
About the problem of APP flash back after appium starts the app - (solved)
关于 appium 如何关闭 app (已解决)
HZOJ #240. 图形打印四
Leetcode question brushing: binary tree 26 (insertion operation in binary search tree)
HZOJ #236. Recursive implementation of combinatorial enumeration
ClickHouse(03)ClickHouse怎么安装和部署
2022 practice questions and mock examination of the third batch of Guangdong Provincial Safety Officer a certificate (main person in charge)
Day21 multithreading
Leetcode brush question: binary tree 24 (the nearest common ancestor of binary tree)
The difference between cache and buffer