Android 有 NumericUpDown 按钮吗?
我尝试在 Android 中找到 NumericUpDown 按钮,但失败了。你知道 Android 中的控制器叫什么吗 - 请告诉我!
<?xml version="1.0" encoding="utf-8"?>
<!--
main.xml
7/22 2010
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<GridView
android:id="@+id/GridView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:numColumns="3"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
android:columnWidth="90dp"
android:stretchMode="columnWidth"
android:gravity="center"
android:background="@color/white"
>
</GridView>
<ButtonUpDown>
<!-- The real name is??? -->
</ButtonUpDown>
</LinearLayout>
感谢您的宝贵时间 编辑:
I've tried to find the NumericUpDown button in Android, but failed. Do you know what the controller is called in Android - please let me know!
<?xml version="1.0" encoding="utf-8"?>
<!--
main.xml
7/22 2010
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<GridView
android:id="@+id/GridView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:numColumns="3"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
android:columnWidth="90dp"
android:stretchMode="columnWidth"
android:gravity="center"
android:background="@color/white"
>
</GridView>
<ButtonUpDown>
<!-- The real name is??? -->
</ButtonUpDown>
</LinearLayout>
Thanx for your time
Edit:
The controller looks like this:
Numeric up down http://www.skogberg.eu/img/numUpDown.png
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
屏幕截图中的视图类似于
com.android.iternal.widget.NumberPicker
,它由某些标准组件使用,例如DatePicker
。不幸的是,该组件不适合公共使用 - 因此包名称中包含
internal
。有一些技巧可以用来实现它,但我建议不要直接访问它。由于这是“私有”代码,API 维护者不会担心不同版本的 Android 中的外部兼容性,因此即使您现在可以让它工作,它也可能会在将来给您带来问题。你最好的选择是 从公共 Android 源存储库获取
NumberPicker
代码,并将其剪切并粘贴到您自己的类中以创建您的 Number Picker 小部件。或者,如果您不想自己执行此操作,拉取
NumberPicker
源代码已经完成并发布在网站上供您下载和使用。The view you have on your screenshot looks likes
com.android.iternal.widget.NumberPicker
which is used by some of the standard components, such asDatePicker
.Unfortunately, this component is not meant for public use - hence the
internal
in the package name. There are some tricks you can use to get to it, but I would recommend against accessing it directly. As this is "private" code the API maintainers aren't going to worry about external compatibility in different versions of Android, so even if you can get it working now it will probably cause your problems in future.Your best bet is to get the code for
NumberPicker
from the public Android source repository and cut and paste it in to your own class to create your Number Picker widget.Or if you didn't want to do this yourself, the work to pull
NumberPicker
from the source has already been done and posted on a website for you to download and use.自 API 11 起,它在 SDK 中可用 - http://developer.android.com/reference /android/widget/NumberPicker.html
It's available in SDK since API 11 - http://developer.android.com/reference/android/widget/NumberPicker.html
这是一个老问题,但我会发布这个以防其他人发现这篇文章:
如前所述,
NumberPicker
是内部的,不供公众使用。使用它从android源复制源代码的最安全的方法。有人已经这样做了并将其发布在这里:http://www.quietlycoding.com/?p=5
另请参阅此进行讨论关于同一主题。
This is an old question, but I will post this in case someone else finds this post:
As mentioned,
NumberPicker
is internal and not for public use. The safest way to use it to copy the source code from android source. Someone already did that and post it here:http://www.quietlycoding.com/?p=5
Also see this for a discussion on same topic.
搜索 android number picker 得到了一些不错的结果,特别是此帖子表明
com.android. Internal.widget.NumberPicker
是日期选择器小部件使用的内容。该线程有一些关于使用/模拟它的建议。Searching for android number picker came up with a few good results, particularly this thread which suggests that
com.android.internal.widget.NumberPicker
is what's used by the date picker widget. The thread has a few suggestions to go about using/emulating it.