我的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>
结果(按钮上的白色文本)
空的新项目。 com.google.android.material:material:1.1.0
如何在EditTextPreference按钮上固定文本颜色?
正如在1.1.0版中所显示的那样,文本颜色是从colorPrimary
而不是colorAccent
中获得的。
解决方法:仅使用样式Theme.MaterialComponents.DayNight.Bridge
详细信息:https://material.io/develop/android/docs/getting-started/#bridge-themes