Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove scrollbar from android support design navigation drawer?

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?

like image 810
qwertz Avatar asked Sep 19 '15 21:09

qwertz


People also ask

How do I remove the scrollbar from my default browser?

If you want to hide the scrollbar and still enable scrolling, then you need to apply a CSS styling to the specific browser you want to affect. To hide the scrollbar from Chrome, Safari, Edge, and Opera, you can use the pseudo-element selector :-webkit-scrollbar and set the display property to none .

What is Navigation drawer activity in Android?

Android Navigation Drawer is a sliding left menu that is used to display the important links in the application. Navigation drawer makes it easy to navigate to and fro between those links. It's not visible by default and it needs to opened either by sliding from left or clicking its icon in the ActionBar.

What is Android drawer layout?

DrawerLayout acts as a top-level container for window content that allows for interactive "drawer" views to be pulled out from one or both vertical edges of the window.


1 Answers

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);
        }
    }
}
like image 122
Mattia Maestrini Avatar answered Sep 22 '22 05:09

Mattia Maestrini