我在DrawerLayout中为我的应用程序导航菜单使用DrawerLayout,这是xml:
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<include
layout="@layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
android:foreground="?android:attr/selectableItemBackground"
android:theme="@style/NavigationDrawerStyle"
app:headerLayout="@layout/nav_header_main"
app:itemIconTint="@color/textColor"
app:itemTextColor="@color/textColor"
app:menu="@menu/activity_main_drawer" />
</android.support.v4.widget.DrawerLayout>问题是:我甚至没有足够的物品滚动,但我看到了这个效果,而试图滚动,我想禁用这个效果,谢谢。
更新
两种方法都在尝试:
android:overScrollMode "never" in NavigationView和
navigationView.setVerticalFadingEdgeEnabled(false);没起作用。
我在onCreate()中调用以下方法:
public void setupDrawerLayout() {
drawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout);
ActionBarDrawerToggle drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolBar, R.string.drawer_open, R.string.drawer_close);
drawerLayout.setDrawerListener(drawerToggle);
drawerToggle.syncState();
navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
}发布于 2016-01-15 13:50:01
您正在尝试禁用滚动阴影。尝试将其添加到NavigationView中
android:overScrollMode="never"如果上述解决方案不起作用,请尝试在活动的onCreate()方法中或在设置UI的任何地方添加此方法:
mNavigationView.setVerticalFadingEdgeEnabled(false);更新
经过更多的测试后,我发现实际上,答案中的解决方案到目前为止都不起作用。然而,我发现这是可行的:
for (int i = 0; i < navigationView.getChildCount(); i++) {
navigationView.getChildAt(i).setOverScrollMode(View.OVER_SCROLL_NEVER);
}在初始化导航抽屉之后,将其添加到onCreate()方法中。
https://stackoverflow.com/questions/34812475
复制相似问题