Higure
Higure

Reputation: 235

NumberPicker rendered incorrectly in a Dialog

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):

from android docs

it's rendered like this:

Why the dividers take up all the space given? How can I fix it?

Upvotes: 1

Views: 488

Answers (1)

Alex Cohn
Alex Cohn

Reputation: 57173

You are using for the picker

android:layout_width="match_parent"

You should use

    android:layout_width="wrap_content"
    android:layout_gravity="center"

Upvotes: 1

Related Questions