Android Change TextColor of selected NumberPicker

Viewed 60

I have created a NumberPicker in Android Studio but I cannot change the color of the selected item. The only thing I have found in this forum is this way:

<style name="AppTheme.Picker" parent="Theme.AppCompat.Light.NoActionBar" >
    <item name="android:textColorPrimary">@android:color/black</item>
</style> 

but that changes the text color of all items.

My NumberPicker:

   <NumberPicker
        android:id="@+id/numberPicker1"
        android:layout_width="306px"
        android:layout_height="300px"
        android:selectionDividerHeight="0dp"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:descendantFocusability="blocksDescendants"
        android:fontFamily="@font/questrial"
        android:scaleX="2.5"
        android:scaleY="2.5"
        android:theme="@style/AppTheme.Picker"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.827"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.513" /> 
<style name="AppTheme.Picker" >
     <item name="android:textSize">50px</item>
 </style> 

sample

In this case, only want to change the text color of 36.4

0 Answers
Related