I'm trying to decrease the size of an Android numberpicker, but already tried several things and I could not. I did not find a responsible attribute the change in size. Wanted to do the following:
Must decrease because I have to put the numberpicker on a screen with lots of information. Any help will be appreciated.
I was facing a similar problem, I wanted to increase the text size of the NumberPicker but couldn't find a way to do it as part of the Widget. In my research I found the following solution:
<NumberPicker
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleX="0.75"
android:scaleY="0.75"/>
Think of scaleX and scaleY as a magnifying factor. Values < 1 will shrink the Widget, 1 will have no change, and > 1 will increase its size.
Number Picker is quite not straight forword to modify or customize. Below is code which will adjust the NumberPicker height to 360dp actual values are considered match parent or wrap content in height will not be considered.
Text color,Text size,divider color can be changed as per style mentioned below
Height and style of number picker:
<NumberPicker
android:id="@+id/np_month"
android:layout_width="wrap_content"
android:layout_height="360dp"
android:theme="@style/AppTheme.Picker" />
Style:
<style name="AppTheme.Picker" parent="Theme.AppCompat.Light.NoActionBar" >
<item name="android:textColorPrimary">@android:color/white</item>
<item name="android:textSize">40sp</item>
<item name="colorControlNormal">@android:color/transparent</item>
</style>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With