我有一个简单的 NumberPicker
就像这样:
我想知道如何让它在所选元素的上方和下方显示更多元素。
例如,在图片中,您可以在所选元素“10”上方看到“9”,在其正下方看到“11”。
我想更改可见行数,以便显示更多元素,例如“7、8、9”,然后是所选元素“10”,然后是“11、12、13”。
这是我的代码:
<NumberPicker
android:id="@+id/picker"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:gravity="center"
android:textColor="@android:color/white"
android:textSize="16sp"
/>
并且我尝试将设置 android:layout_height
更改为 match_parent
并更改为一个大数字(例如 500dp),但它似乎不起作用...
最佳答案
似乎没有办法做到这一点,除非你重写整个数字选择器。
关于android - 设置 NumberPicker 中可见项的数量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30630726/