我正在关注谷歌的优秀博客文章为我的应用程序制作一个黑暗的主题,但我没有看到任何关于如何在我的视图(按钮、应用程序栏等)上获得高程效果的参考。例如,当我将我的应用程序主题设置为
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
并制作一个按钮或卡片时:
<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" />
我希望看到使对象看起来更亮的效果,因为在深色主题中使用了半透明的白色覆盖层来暗示海拔或比背景更接近光源。相反,我的按钮、操作栏等与背景颜色相同,因此不可见。
我的问题是:
- 我必须手动实现这个高程功能还是由材料库提供?
- 如果我让它在 Android 10+ 上自动运行,我是否必须实施手动解决方案以在版本 9 及更早版本上实现向后兼容性?