Android Material 设计主题选择器颜色
Android Material Design Theme picker color
我在 Android 中有一个 Material 设计主题。我想更改我的选择器标签和按钮颜色,因为它显示为白色 (colorPrimary),但我做不到。
这是我的主题:
<resources>
<style name="Theme.Cuponisimo" parent="@style/Theme.AppCompat">
<item name="colorPrimary">@color/azulCuponisimo</item>
<item name="colorControlActivated">@color/azulOscuro</item>
<item name="colorAccent">@color/azulCuponisimo</item>
<item name="colorControlNormal">#ffffff</item>
<item name="colorControlHighlight">@color/azulClaro</item>
<item name="android:statusBarColor">@color/azulCuponisimo</item>
<item name="android:navigationBarColor">@color/azulCuponisimo</item>
<item name="android:textColorPrimary">#ffffff</item>
</style>
<color name="azulCuponisimo">#0a80b0</color>
<color name="azulOscuro">#01506e</color>
<color name="azulClaro">#9dccdf</color>
</resources>
我希望我的选择器具有 azulCuponisimo 颜色,但始终是白色。请帮助我!
最后,我找到了解决方案:
在 android-holo-colors 中创建 ColorSpinner,然后,
custom_theme.xml
<item name="android:spinnerStyle">@style/Spinner</item>
<item name="android:spinnerDropDownItemStyle">@style/SpinnerDropDownItem</item>
<item name="android:spinnerItemStyle">@style/SpinnerItem</item>
styles_nameTheme.xml
<style name="Spinner" parent="android:Widget.Spinner">
<item name="android:background">@drawable/nameTheme_spinner_background_holo_light</item>
<item name="android:dropDownSelector">@drawable/nameTheme_list_selector_holo_light</item>
</style>
<style name="SpinnerDropDownItem" parent="android:Widget.DropDownItem.Spinner">
<item name="android:checkMark">@drawable/nameTheme_btn_radio_holo_light</item>
<item name="android:textColor">@color/verdeOscuro</item>
<item name="android:background">#ffffff</item>
</style>
<style name="SpinnerItem" parent="android:Widget.TextView.SpinnerItem">
<item name="android:textAppearance">@style/AppearanceSpinnerItem</item>
</style>
<style name="AppearanceSpinnerItem" parent="android:TextAppearance.Widget.TextView.SpinnerItem">
<item name="android:textColor">@color/verdeOscuro</item>
</style>
这很完美。希望对你有帮助。
我在 Android 中有一个 Material 设计主题。我想更改我的选择器标签和按钮颜色,因为它显示为白色 (colorPrimary),但我做不到。
这是我的主题:
<resources>
<style name="Theme.Cuponisimo" parent="@style/Theme.AppCompat">
<item name="colorPrimary">@color/azulCuponisimo</item>
<item name="colorControlActivated">@color/azulOscuro</item>
<item name="colorAccent">@color/azulCuponisimo</item>
<item name="colorControlNormal">#ffffff</item>
<item name="colorControlHighlight">@color/azulClaro</item>
<item name="android:statusBarColor">@color/azulCuponisimo</item>
<item name="android:navigationBarColor">@color/azulCuponisimo</item>
<item name="android:textColorPrimary">#ffffff</item>
</style>
<color name="azulCuponisimo">#0a80b0</color>
<color name="azulOscuro">#01506e</color>
<color name="azulClaro">#9dccdf</color>
</resources>
我希望我的选择器具有 azulCuponisimo 颜色,但始终是白色。请帮助我!
最后,我找到了解决方案:
在 android-holo-colors 中创建 ColorSpinner,然后,
custom_theme.xml
<item name="android:spinnerStyle">@style/Spinner</item>
<item name="android:spinnerDropDownItemStyle">@style/SpinnerDropDownItem</item>
<item name="android:spinnerItemStyle">@style/SpinnerItem</item>
styles_nameTheme.xml
<style name="Spinner" parent="android:Widget.Spinner">
<item name="android:background">@drawable/nameTheme_spinner_background_holo_light</item>
<item name="android:dropDownSelector">@drawable/nameTheme_list_selector_holo_light</item>
</style>
<style name="SpinnerDropDownItem" parent="android:Widget.DropDownItem.Spinner">
<item name="android:checkMark">@drawable/nameTheme_btn_radio_holo_light</item>
<item name="android:textColor">@color/verdeOscuro</item>
<item name="android:background">#ffffff</item>
</style>
<style name="SpinnerItem" parent="android:Widget.TextView.SpinnerItem">
<item name="android:textAppearance">@style/AppearanceSpinnerItem</item>
</style>
<style name="AppearanceSpinnerItem" parent="android:TextAppearance.Widget.TextView.SpinnerItem">
<item name="android:textColor">@color/verdeOscuro</item>
</style>
这很完美。希望对你有帮助。