问题
I have a NumberPicker inside an AlertDialog instantiated like this: final NumberPicker np = new NumberPicker(PiattoActivity.this);
.
The problem is, instead of being rendered like this (on the left):

it's rendered like this:
Why the dividers take up all the space given? How can I fix it?
回答1:
You are using for the picker
android:layout_width="match_parent"
You should use
android:layout_width="wrap_content"
android:layout_gravity="center"
来源:https://stackoverflow.com/questions/23857623/numberpicker-rendered-incorrectly-in-a-dialog