Android:如何禁用打开导航抽屉的ActionBar按钮 [英] Android: How to disable the ActionBar button that opens navigation drawer

查看:47
本文介绍了Android:如何禁用打开导航抽屉的ActionBar按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何禁用打开导航抽屉的ActionBar按钮?

How to disable the ActionBar button that opens navigation drawer?

我使用以下代码禁用通过滑动打开导航抽屉的操作,但是其操作栏按钮(位于顶部/左侧)仍然处于活动状态,可以用来打开导航抽屉.

I use the code below to disable opening the navigation drawer using swipe, but its action bar button (at Top/Left) still active and can be used to open the navigation drawer.

 DrawerLayout navigationDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
 navigationDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);

推荐答案

尝试一下,我认为它将为您提供帮助

Try This i think it Will help you

actionBar.setDisplayHomeAsUpEnabled(false);

或者您可以使用此

getActionBar().setDisplayHomeAsUpEnabled(false);

这篇关于Android:如何禁用打开导航抽屉的ActionBar按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆