So I've added Navigation Drawer and because of it I have to use Toolbar in my layout xml file (instead of using theme with action bar Theme.AppCompat.Light.DarkActionBar
, and now it's Theme.AppCompat.Light.NoActionBar
)
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"/>
</com.google.android.material.appbar.AppBarLayout>
I found this answer to add shadow below toolbar (AppBarLayout
) https://stackoverflow.com/a/31026359/9766649
But it only works for Android 21+
With Theme.AppCompat.Light.DarkActionBar
shadow is working for older Android
So the only solution is to use custom shadow like https://stackoverflow.com/a/26904102/9766649 ?