当前位置:网站首页>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
边栏推荐
- Sed of three swordsmen in text processing
- 2022-07-07 Daily: Ian Goodfellow, the inventor of Gan, officially joined deepmind
- 【学习笔记】AGC010
- 基于鲲鹏原生安全,打造安全可信的计算平台
- Leetcode skimming: binary tree 21 (verifying binary search tree)
- 日本政企员工喝醉丢失46万信息U盘,公开道歉又透露密码规则
- Analysis of DHCP dynamic host setting protocol
- Day-19 IO stream
- ClickHouse(03)ClickHouse怎么安装和部署
- Master公式。(用于计算递归的时间复杂度。)
猜你喜欢

About the problem of APP flash back after appium starts the app - (solved)

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

Leetcode skimming: binary tree 21 (verifying binary search tree)
![[crawler] avoid script detection when using selenium](/img/3a/85ea729be2aa76c3de4a822ca6939b.png)
[crawler] avoid script detection when using selenium

关于 appium 启动 app 后闪退的问题 - (已解决)

Day-16 set

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

Leetcode skimming: binary tree 25 (the nearest common ancestor of binary search tree)

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

【无标题】
随机推荐
Leetcode skimming: binary tree 27 (delete nodes in the binary search tree)
【无标题】
ICLR 2022 | pre training language model based on anti self attention mechanism
Unity 构建错误:当前上下文中不存在名称“EditorUtility”
Steps of building SSM framework
Practical case: using MYCAT to realize read-write separation of MySQL
高瓴投的澳斯康生物冲刺科创板:年营收4.5亿 丢掉与康希诺合作
Cookie
非分区表转换成分区表以及注意事项
关于 appium 如何关闭 app (已解决)
为租客提供帮助
[difficult and miscellaneous]pip running suddenly appears modulenotfounderror: no module named 'pip‘
Design and implementation of communication protocol
Image pixel read / write operation
谷歌浏览器如何重置?谷歌浏览器恢复默认设置?
[untitled]
国泰君安证券开户怎么开的?开户安全吗?
Day-18 hash table, generic
2022 polymerization process test question simulation test question bank and online simulation test
Test next summary