在Android中使用NumberPicker 3 [英] Using NumberPicker in Android 3

查看:106
本文介绍了在Android中使用NumberPicker 3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用NumberPicker小部件的Andr​​oid 3.1。我想,现在是一个标准的小工具,一个公共API的一部分,而不是一个内部小部件了。 然而,这是行不通的。我可以在里面看到一个文字编辑为0,但没有按钮,我不能把它的滚动,我不能进入一个新的数字键盘,无论是。

I'm trying to use the NumberPicker widget in Android 3.1. I figure it is now a standard widget, part of a public API, and not an internal widget anymore. However, it doesn't work. I can see a textEdit with "0" in it, but there are no buttons, I can't scroll it, and I can't enter a new number with keyboard, either.

下面是我用于测试的XML:

Here's the xml I used for testing:

    

    <NumberPicker
        android:id="@+id/numberPicker1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</LinearLayout>

因你们不工作,我的意思是这样的:它不具备显示箭头(见的截图),并在仿真器的键盘不出来。在真实设备上它,但我不能输入的文字,我只能将它抹去。

By saying doesn't work I mean this: it doesn't have arrows displayed (see the screenshot), and on emulator the keyboard doesn't show up. On a real device it does, but I can't type in the text, I can only erase it.

有什么建议?我真的很讨厌写我自己的小部件时,有一个标准。

Any suggestions? I really hate to write my own widget when there is a standard one.

推荐答案

尝试通过

<一个href="http://developer.android.com/reference/android/widget/NumberPicker.html#setMaxValue%28int%29">setMaxValue <一href="http://developer.android.com/reference/android/widget/NumberPicker.html#setMinValue%28int%29">setMinValue或<一href="http://developer.android.com/reference/android/widget/NumberPicker.html#setDisplayedValues%28java.lang.String%5B%5D%29">setDisplayedValues

也许NumberPicker不能正常工作,如果它不知道哪些值显示。

maybe the NumberPicker is not working if it doesn't know which values to display.

这篇关于在Android中使用NumberPicker 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆