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?

mohammad anouti
  • 171
  • 2
  • 18

2 Answers2

2

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>

Leo Zhu
  • 15,726
  • 1
  • 7
  • 23
0

What are the settings of your android version / SDK. Maybe you have set a too high version, so the app doesn't work on devices that have a lower android version than your own pocophone.

You can change the settings under your Android project properties -> Application, set the Target Android Version and Compile using Android Version to API Level (of your tablet) to fix it.

Joost
  • 42
  • 7
  • I lower the android version to 5.0, it gives me an error on the Xamarin.Android.Support NuGet packages that are not compatible with monoandroid50. Does it mean that I need to downgrade them to be compatible? and how I know the compatible version for them? – mohammad anouti Jun 11 '19 at 10:02
  • maybe try to rebuild your app? – Joost Jun 11 '19 at 10:14
  • Of course, I tried to clean and rebuild it and the same errors stays – mohammad anouti Jun 19 '19 at 09:25