I'm following google's excellent blog post to make a dark theme for my app, but I don't see any reference on how I get the elevation effects on my views(buttons, app bar, etc) to work. For example when I set my app theme to
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
and make a button or a card like so:
<Button
android:id="@+id/keypadOne"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@color/surface"
android:elevation="01dp"
android:text="@string/one"
android:textColor="@color/onSurface"
android:textSize="36sp" />
I would expect to see the effect that makes the object appear lighter due to the semi-transparent white overlay used in dark themes to imply elevation or being closer to a light source than the background. Instead, my buttons,action bar, etc, are the same color as the background and therefore invisible.
My questions are:
- Do I have to implement this elevation functionality manually or is that provided by the Material library?
- If I get this working automatically for Android 10+ will I have to implement a manual solution for backwards compatibility on versions 9 and earlier?