I am using the new Bottom App Bar from the Material Design Components. I am trying to give shadow at the top of the Bottom App Bar like the one in Google Tasks app as shown below.
I have tried using both android:elevation
and app:elevation
attribute. Please help.
I ended up using this solution.
Step 1
Create a shape_drawable.xml
file in the drawable folder as shown below:
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#1F000000"
android:endColor="@android:color/transparent"
android:angle="90" />
</shape>
Step 2
Create a View
, set the shape_drawable.xml
as its background and then place the view just above the BottomAppBar.
<View
android:layout_width="match_parent"
android:layout_height="4dp"
android:layout_above="@id/bottom_bar"
android:background="@drawable/shape_drawable"/>
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