Home > Enterprise >  Change Text Color for Xamarin TimePicker
Change Text Color for Xamarin TimePicker

Time:01-13

How can I change the color of the text circled in the below screenshot? I played around with the style.xml but have not yet found any property that impacts this parts. TimePicker

CodePudding user response:

Add the following code into style.xml in android project.

  1. Create a new style which defines the color on Timepicker.

    <style name="Theme.picker" parent="Theme.AppCompat.Light.Dialog">
         //background color
         <item name="android:background">#13216a</item>
         //Title background color
         <item name="colorAccent">#f8a519</item>
         //text color
         <item name="android:textColor">#FF0000</item>
          //number text color
         <item name="android:textColorPrimary">#FF66FF</item>        
    </style>
    
  2. Apply the style in MainTheme .

    <item name="android:timePickerDialogTheme">@style/Theme.picker</item>
    

Screen shot

Before After

Notice: This is a simple solution, and it will also change the button text color, if you want to separate them, you will need a custom renderer.
  •  Tags:  
  • Related