Android not showing shadows on elevated view with SVG background
Asked Answered
T

0

8

I have a View that I want to use an SVG/Vector as it's background. So it's not a perfect square, rounded, or any basic shape. I would like a drop shadow to surround the background, but it isn't working.

I'll set the elevation, set the outline provider, and have even tried setting the clip to padding even though it's well within the bounds of it's layout.

<View
                android:layout_width="200dp"
                android:layout_height="300dp"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintRight_toRightOf="parent"
                android:outlineProvider="background"
                android:background="@drawable/ic_bookmark_black_24dp"
                android:elevation="5dp"/>

(You can test this yourself with the Android bookmark vector asset you can import from Android Studio)

Still, no shadow. The moment I change the background to a color, it works just fine

Tryma answered 8/8, 2019 at 19:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.