Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to decrease padding in NumberPicker

Tags:

How to decrease padding in NumberPicker

enter image description here

I want something like it:

enter image description here

like image 933
comalex3 Avatar asked Jan 04 '16 21:01

comalex3


1 Answers

It's surprisingly easy to archive:

enter image description here
(scaleX and scaleY equals 2.5)

enter image description here
(without scaleX and scaleY)

    String[] values = {"Public", "Shared", "Private",....};      NumberPicker np=             (NumberPicker) findViewById(R.id.numberPicker);     np.setMaxValue(values.length-1);     np.setMinValue(0);     np.setDisplayedValues(values); 

And simply set small layout_height and scaleX, scaleX:

<NumberPicker     android:id="@+id/numberPicker"     android:layout_width="wrap_content"     android:layout_height="50dp"     android:scaleX="2.5"     android:scaleY="2.5"/> 

I do agree, that standard NumberPicker is hardly customizable, though.

I hope, it helps

like image 155
Konstantin Loginov Avatar answered Sep 29 '22 07:09

Konstantin Loginov