0

我有两个包含首选项部分的应用程序,并且我正在使用首选项库,这是撰写本文时可用的最新版本:

    implementation "androidx.preference:preference:1.2.0-rc01"

现在,我将我的应用程序设置为使用并遵循新的 Material3 (或Material You)主题,但我面临的一个问题是,虽然普通对话框的主题正确,但首选项部分中的对话框只是部分主题(角半径)。他们显然不使用新样式,这种不一致正在杀死我:D

法线材质 You 对话框 首选项对话框

目前,如果没有奇怪的解决方法,我没有找到一种方法来为它们设置主题,所以我会很感激你的建议。这是我目前的对话框样式

<!-- Dialog theme -->
<style name="ThemeOverlay.App.MaterialAlertDialog" parent="ThemeOverlay.Material3.MaterialAlertDialog">
    <item name="colorOnSurface">?colorAccent</item>
    <item name="alertDialogStyle">@style/MaterialAlertDialog.App</item>
    <item name="dialogCornerRadius">@dimen/bottom_sheet_corners</item>
</style>

<!-- Note: shape appearance doesn't work with the preference dialogs (they're not material) -->
<style name="MaterialAlertDialog.App" parent="MaterialAlertDialog.Material3">
    <item name="shapeAppearance">@style/ShapeAppearance.App.MediumComponent</item>
    <item name="shapeAppearanceOverlay">@null</item>
</style>

也许这只是等待的问题

4

0 回答 0