Error accessing style: Resource is not public. (at 'style' with value '@android: style / Widget.NumberPicker')

1

The style I want to use is the following, but I get a non-public resource error

 <NumberPicker
        android:id="@+id/pruebaNumber"
        style="@android:style/Widget.NumberPicker"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="26dp"
        android:layout_marginStart="26dp"
        android:layout_marginTop="40dp"
        android:layout_toEndOf="@+id/textView7"
        android:layout_toRightOf="@+id/textView7" />
    
asked by Oscar Oliva 19.12.2017 в 16:22
source

1 answer

0

Use Number Picker . For that you will do the following:

In your application graddle add the following within dependencies :

 compile 'com.shawnlin:number-picker:2.4.4'

Synchronize the project. Then you add the NumberPicker to your view:

<com.shawnlin.numberpicker.NumberPicker
    android:id="@+id/number_picker"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    app:np_width="64dp"
    app:np_height="180dp"
    app:np_dividerColor="@color/colorPrimary" // color que lo divide
    app:np_formatter="@string/number_picker_formatter"
    app:np_max="59" // maximo de los numeros del picker
    app:np_min="0" // minimo de los numeros
    app:np_selectedTextColor="@color/colorPrimary" // color del numero seleccionado
    app:np_selectedTextSize="@dimen/selected_text_size" // tamaño del numero seleccionado
    app:np_textColor="@color/colorPrimary" // color de los numeros
    app:np_textSize="@dimen/text_size" // tamano por defecto de lo snumeros
    app:np_value="3" /> // valor seleccionado

The default orientation is vertical but if you want horizontal, just add the following:

np_orientation="horizonal"
    
answered by 19.12.2017 / 17:00
source