将主题更改为MaterialComponent默认的EditTextPreference按钮后,现在带有白色文本

问题描述 投票:0回答:1

我的styles.xml

<style name="AppTheme" parent="Theme.MaterialComponents.DayNight"><!-- MaterialComponents theme -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

我的preferences.xml

<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
    <!-- Default EditTextPreference created by default -->
    <EditTextPreference
        app:key="signature"
        app:title="@string/signature_title"
        app:useSimpleSummaryProvider="true" />
</PreferenceScreen>

结果(按钮上的白色文本)

enter image description here

空的新项目。 com.google.android.material:material:1.1.0

如何在EditTextPreference按钮上固定文本颜色?

android android-styles material-components-android
1个回答
0
投票

正如在1.1.0版中所显示的那样,文本颜色是从colorPrimary而不是colorAccent中获得的。

详细信息:https://github.com/material-components/material-components-android/issues/1009#issuecomment-585285178


解决方法:仅使用样式Theme.MaterialComponents.DayNight.Bridge

详细信息:https://material.io/develop/android/docs/getting-started/#bridge-themes

© www.soinside.com 2019 - 2024. All rights reserved.