卸下支持Android设计的导航抽屉式滚动条? [英] Remove scrollbar from android support design navigation drawer?

查看:364
本文介绍了卸下支持Android设计的导航抽屉式滚动条?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚更新从22.2.1支持设计库23.0.1并立即注意到了抽屉式导航滚动条的presence。我试图用

I just updated the support design library from 22.2.1 to 23.0.1 and immediately noticed the presence of a scrollbar in the navigation drawer. I tried to use

android:scrollbars="none"

但是,这并没有解决它。是否有任何其他的方式来删除滚动条?

But that didn't fix it. Is there any other way to remove the scrollbar?

推荐答案

不幸的是滚动条设置在 NavigationMenuView 布局不是在 NavigationView ,因为这个原因,如果你使用的android:滚动条=无滚动条仍然是present

Unfortunately the scrollbar is set in the NavigationMenuView layout not in the NavigationView, for this reason if you use android:scrollbars="none" the scrollbar is still present.

您可以做到这一点编程方式调用此方法:

You can do it programmatically calling this method:

private void disableNavigationViewScrollbars(NavigationView navigationView) {
    if (navigationView != null) {
        NavigationMenuView navigationMenuView = (NavigationMenuView) navigationView.getChildAt(0);
        if (navigationMenuView != null) {
            navigationMenuView.setVerticalScrollBarEnabled(false);
        }
    }
}

这篇关于卸下支持Android设计的导航抽屉式滚动条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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