更改对话框消息颜色

时间:2019-06-16 01:49:35

标签: java android xml kotlin

我有一个自定义首选项,扩展了const mapSelectors = myIcon => ( <FeatureGroup> <EditControl style={{ backgroundColor: "blue" }} onCreated={event => _onCreate(event)} draw={{ polyline: { shapeOptions: { color: "red" }, allowIntersection: false, showLength: true, metric: false, feet: false }, polygon: { allowIntersection: false, shapeOptions: { color: "blue" }, edit: false, showLength: true, metric: false, feet: false, showArea: true }, rectangle: { shapeOptions: { color: "green" }, showLength: true, metric: false, feet: false, showArea: true }, circle: { shapeOptions: { color: "magenta" }, showLength: true, metric: false, feet: false, showArea: true }, marker: { zIndexOffset: "999", edit: true, icon: myIcon } }} /> {/* {(L.drawLocal.draw.toolbar.buttons.polygon = "draw")} */} <Circle center={[51.51, -0.06]} radius={200} /> </FeatureGroup> ); class MapEditing extends React.Component { constructor(props) { super(props); this.state = { draw: false }; } render() { const { classes, save, myIcon } = this.props; return ( {this.state.draw && mapSelectors()} ) ``` Additional form code not shown

EditTextPreference

preferences.xml

class DeleteAccountPreference(context: Context, attrs: AttributeSet) : EditTextPreference(context, attrs) {
    ...
}  

我已将自定义主题应用于:

styles.xml

<my.app.DeleteAccountPreference
    android:layout="@layout/preference_click"
    android:key="delete_account"
    android:title="Delete Account"
    android:dialogMessage="@string/delete_account_message" />

enter image description here

无论我将什么添加到<style name="BaseTheme" parent="Theme.AppCompat.NoActionBar"> ... <item name="alertDialogTheme">@style/AlertDialogTheme</item> </style> <style name="AlertDialogTheme" parent="Theme.AppCompat.Light.Dialog.Alert"> <item name="android:background">@color/colorIcons</item> <item name="colorPrimary">@color/colorLightBlack</item> <item name="colorAccent">@color/colorAccent</item> <item name="colorPrimaryDark">@color/colorExit</item> <item name="editTextColor">@color/colorAccent</item> <item name="android:textColorHint">#000000</item> <item name="android:windowBackground">@color/colorPrimary</item> </style> ,我似乎都无法更改下面显示的AlertDialogTheme颜色(白色)。

知道要更改此颜色需要添加什么dialogMessage

enter image description here

2 个答案:

答案 0 :(得分:2)

您应将android:textColorSecondary应用于您的活动主题:

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    ...
    <item name="android:textColorSecondary">#FF5722</item>
</style>

然后您将看到一条橙色消息内容:

请注意,这将影响此活动中所有其他依赖于textColorSecondary属性的视图。我试图使此更改仅影响特定的首选项,但不幸的是,PreferenceFragmentCompat会忽略提供的Context并将使用活动的上下文,因此不会传递带有自定义主题的ContextThemeWrapper生效。我想这是Google团队的明智决定,这意味着该首选项屏幕中的所有属性都应适应相同的配色方案。

答案 1 :(得分:0)

将以下项目添加到AlertDialogStyle。


application/config.php
...
$config['csrf_protection'] = FALSE; // TRUE