Search code examples
androidandroid-layoutandroid-themeandroid-stylesandroid-elevation

Android elevation not there throughout whole app


I have a problem with my Android App: The elevation is not working throughout the whole app. My CardViews are not elevated, my Toolbars don't have this little elevation to it and you can also not see the edge of my BottomNavigationView, because it is white and the Effect is not there, so there is no line.

Do you have any clue, why this could be the case? I have googeled about this, but I never found anything that affected the whole application. If you need more information, please ask and I will be happy to provide it.

Some (maybe) important Details - All my Activities and Fragments use the "AppTheme.NoActionBar"

Thanks a lot for any suggestions

my styles.xml:

<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>

    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat" />

<style name="AppTheme.NoActionBar.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

<style name="AppTheme.NoActionBar.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

<style name="AppTheme.BottomSheetDialog" parent="Theme.Design.Light.BottomSheetDialog">
    <item name="bottomSheetStyle">@style/AppTheme.BottomSheetStyle</item>
</style>

<style name="AppTheme.BottomSheetStyle" parent="Widget.Design.BottomSheet.Modal">
    <item name="behavior_hideable">true</item>
    <item name="behavior_skipCollapsed">true</item>
</style>

<!--<style name="myDialog" parent="Theme.AppCompat.Light.Dialog">
    <item name="android:windowNoTitle">true</item>
</style>-->



<!-- added from new -->
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
    <item name="android:windowBackground">@drawable/splash_background</item>
</style>

<style name="CardView.Round" parent="Base.CardView">
    <item name="cardCornerRadius">10dp</item>
    <item name="cardElevation">3dp</item>
</style>

<style name="Borderless.Button.Accent" parent = "Borderless.Button">
    <item name="android:textColor">@color/colorAccent</item>

</style>

<style name="Borderless.Button" parent="Widget.AppCompat.Button.Borderless">
    <item name="android:textStyle">bold</item>
    <item name="android:textSize">18sp</item>
</style>


Solution

  • you need to set android:hardwareAccelerated="true" attribute on AndroidManifest.xml file