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?
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 .
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.
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.
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);
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With