oroblam
oroblam

Reputation: 109

Number Picker displays numbers out of margin

I've been trying to fix this issue for hours now but it looks like I'm the only one having it.

NumberPickers

I shouldn't see the number above and below the blue line. Here is the XML

    <android.support.v7.widget.GridLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:useDefaultMargins="true"
            android:layout_margin="3dp"
            app:columnCount="3"
            app:rowCount="7">

    ........

    <NumberPicker
            app:layout_column="1"
            app:layout_row="3"
            android:id="@+id/n_of_dies"
            style="@style/inputNumbers"
            android:layout_width="wrap_content"
            app:layout_gravity="fill_horizontal"
            />
     <NumberPicker
            app:layout_column="1"
            app:layout_row="4"
            app:layout_gravity="fill_horizontal"
            android:id="@+id/carbon_content"
            style="@style/inputNumbers" 
            android:layout_width="wrap_content"
            app:layout_gravity="fill_horizontal"
            />
      ........

The content of Input numbers is

 <style name="inputNumbers">
    <item name="android:padding">10dp</item>
    </style>

any ideas?

Upvotes: 0

Views: 2870

Answers (1)

a.bertucci
a.bertucci

Reputation: 12142

Given the problem is how you're using the paddings I'd recommend to take a look at the widget style (the Holo variation) if you want to change the default look:

...

<style name="Widget.NumberPicker">
  <item name="android:internalLayout">@android:layout/number_picker</item>
  <item name="android:orientation">vertical</item>
  <item name="android:fadingEdge">vertical</item>
  <item name="android:fadingEdgeLength">50dip</item>
</style>

...

<style name="Widget.Holo.NumberPicker" parent="Widget.NumberPicker">
  <item name="android:internalLayout">@android:layout/number_picker_with_selector_wheel</item>
  <item name="android:solidColor">@android:color/transparent</item>
  <item name="android:selectionDivider">@android:drawable/numberpicker_selection_divider</item>
  <item name="android:selectionDividerHeight">2dip</item>
  <item name="android:selectionDividersDistance">48dip</item>
  <item name="android:internalMinWidth">64dip</item>
  <item name="android:internalMaxHeight">180dip</item>
  <item name="virtualButtonPressedDrawable">?android:attr/selectableItemBackground</item>
</style>

Upvotes: 1

Related Questions