NumberPicker rendered incorrectly in a Dialog

走远了吗. 提交于 2019-12-08 08:21:51

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!