0

How to change the color of number picker items(numbers, texts)?

I tried changing color with styles.xml file but it didn't work

styles.xml :

<?xml version="1.0" encoding="utf-8"?>
 <resources xmlns:android="http://schemas.android.com/apk/res/android">
 <style name="NumberPickerText">
    <item name="android:textSize">20dp</item>
    <item name="android:textColor">@color/white</item>
 </style>
 </resources>

main_activity.xml :

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:id="@+id/parentLayout_homesearch"
  android:layout_width="match_parent"
  android:layout_height="fill_parent"
  android:background="@color/white"
  android:orientation="vertical">
 <NumberPicker
 android:theme="@style/NumberPickerText"
 android:id="@+id/numberPicker1"
 android:layout_width="150dp"
 android:layout_height="wrap_content"
 android:layout_alignParentStart="true" />
</LinearLayout>
Krupa Kakkad
  • 833
  • 1
  • 13
  • 27
shwetag21
  • 23
  • 6
  • check this ans it may help you https://stackoverflow.com/questions/22962075/change-the-text-color-of-numberpicker – AskNilesh Aug 28 '17 at 06:40
  • Refer this link https://stackoverflow.com/questions/22962075/change-the-text-color-of-numberpicker – vijay chaudhary Aug 28 '17 at 06:41
  • I hope this link may be helpful for you. https://stackoverflow.com/questions/15031624/how-to-change-number-picker-style-in-android – Kyaw Kyaw Aug 28 '17 at 07:23

0 Answers0