Search code examples
xamarin.formsandroid-stylespicker

Picker button's color not changing on android 5.1


I was searching for a way to change the colors of the ok and cancel button of my custom picker. I added this code to the styles file on the android project:

<style name="SpinnerDialog" parent="Theme.AppCompat.Light.Dialog">
    <item name="android:popupBackground">#039BE5</item>
    <item name="colorPrimary">#039BE5</item>
    <item name="colorPrimaryDark">#039BE5</item>
    <item name="colorAccent">#039BE5</item>
  </style>

I run the app on my Xiaomi POCOPHONE F1 (Android v9) and on 2 emulators (Android v8.1) the color changed and everything worked fine, I tried deploying the app on my tablets (Android v5.1) the colors didn't change!!

Am I missing something?


Solution

  • if you want to use style for the dialog ,you could try this:

    in your theme style:

    <item name="android:alertDialogTheme">@style/SpinnerDialog</item>
    

    then custom dialog style:

    <style name="SpinnerDialog"
         parent="android:Theme.Material.Light.Dialog.Alert">
    <item name="android:colorAccent">#039BE5</item>