Android 有 NumericUpDown 按钮? [英] Android having NumericUpDown Button?
问题描述
我试图在 Android 中找到 NumericUpDown 按钮,但失败了.您知道 Android 中的控制器叫什么吗?请告诉我!
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>
感谢您的时间
控制器看起来像这样:数字向上向下 http://www.skogberg.eu/img/numUpDown.png
推荐答案
您在屏幕截图上的视图看起来像一些标准使用的 com.android.iternal.widget.NumberPicker
组件,例如 DatePicker
.
The view you have on your screenshot looks likes com.android.iternal.widget.NumberPicker
which is used by some of the standard components, such as DatePicker
.
不幸的是,此组件不适合公共使用 - 因此包名称中包含 internal
.有您可以使用的一些技巧,但我建议不要直接访问它.由于这是私有"代码,API 维护人员不会担心不同 Android 版本的外部兼容性,因此即使您现在可以使用它,将来也可能会导致您的问题.
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.
你最好的选择是 从公共 Android 源代码库 获取 NumberPicker
的代码,并将其剪切并粘贴到您自己的类中以创建您的 Number Picker 小部件.
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.
或者如果你不想自己做,拉NumberPicker的工作
源码已经做好,贴在网站上供大家下载使用.
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.
这篇关于Android 有 NumericUpDown 按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!