2016-08-02 96 views
1

我无法移除棒棒糖及更高版本的NavigationView的海拔(阴影)。 我将mDrawerLayout.setScrimColor(Color.TRANSPARENT);添加到了我的DrawerLayout中,但它会影响前棒棒糖版本。我还尝试将app:elevation="0dp"android:elevation="0dp"添加到我的NavigationView但未成功。Android NavigationView移除海拔

enter image description here

我需要的安卓4.0在Android 6.

回答

1

我已经找到了解决办法:

mDrawerLayout.setDrawerElevation(0); 

enter image description here

0

您是否尝试过这样的结果呢?

yourDrawer.setDrawerShadow(R.drawable.someDrawable, GravityCompat.START); 

How to disable DrawerLayout Shadow

+1

感谢您的回答。是的,我试过了。没有效果为Android 6.我'R.drawable.someDrawable'是'<形状xmlns:android =“http://schemas.android.com/apk/res/android”> '。此外,您链接的解决方案是2013年,不幸的是,它不适用于> android 5.0。我想问题在于提升。 UPD:我只是试图使用png图像作为'R.drawable.someDrawable'。不幸的是,没有效果。 – GrafOrlov

+0

''someDrawable'应该是这样的PNG文件:https://developer.android.com/samples/NavigationDrawer/res/drawable-hdpi/drawer_shadow.9.html 尝试使用GravityCompat.END而不是GravityCompat。开始 – alway5dotcom

1

继承人只有XML的解决方案。

<android.support.design.widget.NavigationView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     app:elevation="0dp" 
     app:menu="@menu/navigation_menu" />