Reputation: 964
I tried to set the elevation of a NavigationView using both android:elevation
and app:elevation
. But neither of them seem to work. I also tried to set the elevation programmatically by using setElevation(float)
. This also didn't work.
My XML looks like this:
<android.support.design.widget.NavigationView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:menu="@menu/drawer"
app:headerLayout="@layout/header"
android:id="@+id/navView"
android:paddingTop="24dp"
app:elevation="16dp"/>
So, how to properly set the elevation of a NavigationView?
Upvotes: 4
Views: 857
Reputation: 3248
For future googlers,
to remove the drawer shadow, you have to set it from the DrawerLayout
and not from the NavigationView
itself!
so from code it will be:
DrawerLayout drawerLayout = findViewById(R.id.drawerLayout);
drawerLayout.setDrawerElevation(0);
Upvotes: 0
Reputation: 31
Use of the codes:
<android.support.design.widget.NavigationView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:layout_marginTop="?attr/actionBarSize"
app:headerLayout="@layout/drawer_header"
app:menu="@menu/drawer"/>
ere
Upvotes: -2