Android首选项夜间模式主题

时间:2019-09-07 22:39:25

标签: java android kotlin themes

我想实现MaterialComponents中的DayNight theme

在我的android应用程序中,我使用首选项片段。不幸的是,对话框按钮(positivenegative)在白天模式下为白色,而在夜间模式下为灰色。我想在主题中更改此行为,但是我不知道应该使用什么键。

我已经尝试根据official documentation使用其他密钥。

例如使按钮颜色变为白色:

<style name "AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
    <item name="colorOnBackground">@android:color/white</item>
    <item name="colorButtonNormal">@android:color/white</item>
    <item name="colorOnSurface">@android:color/white</item>
    <item name="colorOnPrimary">@android:color/white</item>
    <item name="colorOnSecondary">@android:color/white</item>
    <item name="colorOnPrimarySurface">@android:color/white</item>
</style>

不幸的是,这不会改变任何东西。

这是夜间模式: Night mode

对话框按钮应为白色。

0 个答案:

没有答案