Android 有 NumericUpDown 按钮吗?

发布于 2024-09-11 09:48:06 字数 971 浏览 12 评论 0原文

我尝试在 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>

感谢您的宝贵时间 编辑:

控制器如下所示: 数字向上向下 http://www.skogberg.eu/img/numUpDown.png

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

那片花海 2024-09-18 09:48:06

屏幕截图中的视图类似于 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 as DatePicker.

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.

琴流音 2024-09-18 09:48:06

这是一个老问题,但我会发布这个以防其他人发现这篇文章:

如前所述,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.

揽月 2024-09-18 09:48:06
<android.widget.NumberPicker
    android:id="@+id/numberPicker1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >
</android.widget.NumberPicker>
<android.widget.NumberPicker
    android:id="@+id/numberPicker1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >
</android.widget.NumberPicker>
讽刺将军 2024-09-18 09:48:06

搜索 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文