Search code examples
androidandroid-layoutandroid-actionbarmaterial-designandroid-actionbar-compat

Android AppBar not showing shadow


The AppBar and BottomNavigationView don't display any shadow on the listview between them even with

setSupportActionBar().setElevation(3.0f);

I have the following layout

CordinatorLayout
--LinearLayout

----AppBarLayout
-----------Toolbar
----/AppBarLayout

----FrameLayout
-----------ListView
----/FrameLayout

----BottomNavigationView

--/LinearLayout
/CordinatorLayout

what are the other possibilities the shadow isn't drawn

Edit,

---------------------------------------------------------------------------------------------------------

older devices like Galaxy s3 running Android 4.4.2 still doesn't show any shadow, even with hardware acceleration enabled


Solution

  • So the issue wasn't related to toolbar elevation, view clipping or incorrect layouts, the manifest entry for this particular activity had hardware acceleration turned off.

    <activity
    ..
    ..
    ..
    android:hardwareAccelerated="false"/>
    

    changing this to true fixed it