问题标签 [android-number-picker]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
234 浏览

android - 滚动时设置动画时 NumberPicker 冻结

我有一个 numberPicker 包裹在一个 RelativeLayout 中,下面有一些按钮:

Wrapping 设置为 false ,如下所示:

这个 RelativeLayout 通过动画滑入:

一旦完成选择器,用户点击一个按钮,该按钮应该折叠RelativeLayout:

然后当点击确定按钮时,我想将选择器向上滑动。但是在进行最轻微的滚动时这样做会导致 ANR。我不知道为什么会这样。我什至试图通过反射来强制停止投掷和调整滚动条。这似乎有点帮助,但仍然可以冻结应用程序。还要检查滚动状态是否处于空闲状态并且直到视图处于空闲状态才折叠视图,仍然会出现冻结应用程序的情况。

在此处输入图像描述

编辑:

我刚刚发现,当你为高度设置动画时,显然会影响当前值。这可能是无限循环的原因。我想我也应该注意到我打电话给mDatePicker.setWrapSelectorWheel(false);. 当不调用这个时,它似乎没有冻结。即使我不想包裹选择轮。

0 投票
1 回答
1345 浏览

android - 范围号码选择器

我将Numberpicker视为从最小值为 0 的范围中选择一个数字的工具。我正在寻找一个范围选择器视图,以便能够选择一个值范围(而不是一个范围中的值),包括负值(对于例如(-100,+200))。是否有为此预先构建的解决方案?

0 投票
0 回答
356 浏览

android - 更改数字选择器项目的颜色

如何更改数字选择器项目(数字、文本)的颜色?

我尝试使用 styles.xml 文件更改颜色,但没有成功

样式.xml:

main_activity.xml:

0 投票
1 回答
6649 浏览

android - NumberPicker 材质样式自定义选择分隔线

我想自定义数字选择器选择分隔线。

数字选择器选择分隔符

我创建了用于数字选择器选择分隔符的自定义可绘制对象。

我创建了继承数字选择器材质样式的自定义材质样式。

但 selectionDivider 属性无法识别。如何将自定义可绘制对象添加到数字选择器材质样式以设置自定义选择分隔线?

0 投票
1 回答
298 浏览

android - 替换 NumberPicker 的 textView - Android

所以我有一些textViews他们的输入是数字,但为了不易出错,我想将其替换为numberPickers.

我做了什么

  • TextViews工作
  • NumberPickers工作
  • 任何数学和计算工作

我需要什么

  • 更换输入法

  • 这就是我的textViews

    /li>

这些是我的pickers

任何帮助将不胜感激

谢谢

0 投票
1 回答
330 浏览

android - Using NumberPicker in android but with strings from SQlite

Is it possible to create something like a NumberPicker Widget in android but populate it with a series of strings pulled from an SQLite database?

If there's only one entry, then the spinner would have one string, if there is a hundred, then there would be a hundred entries. There cannot be less than one entry by design, as in, the activity can't be entered without at least one entry. There is no hardset upper limit, but the data will be populated by date and it is VERY unlikely that this data set would ever exceed a thousand entries due to the nature of how the data is created.

What I'm trying to do is show data saved in an SQLite database, the name of each dataset would be displayed in the NumberPicker, then the user could quickly scroll through the data. The data is then going to be be displayed in a Bar Chart (MPandroidcharts library), as they scroll past the dataset in the NumberPicker. At least, that's the goal.

I've managed the SQLite database, and I've got the charts working for single datasets, I just can't figure out how to get the data selection side working.

0 投票
1 回答
135 浏览

java - 将号码从 NumberPicker 发送到 Firebase

有没有办法将号码从发送NumberPickerFirebase?我已经NumberPickerGITHUB. 但是我想在选择要发送到的号码时Firebase,有没有办法?

我试过这段代码:

Firebase 的代码:

但它不起作用。

0 投票
0 回答
315 浏览

android - 在数字选择器中隐藏上一个/下一个数字

我正在寻找隐藏数字选择器(Android)中的顶部和底部数字,以便您只能看到“选定项目”区域内的内容。

我似乎无法弄清楚如何修改数字选择器类以阻止它绘制这些数字。我知道以前有人问过这个问题,特别是在这个问题中,但没有显示解决方案。我从来不需要做一个方法覆盖,这有点令人困惑。

谢谢

0 投票
0 回答
1217 浏览

android - numberpicker,拦截选择器停止滚动时

我需要用两个 numberPicker、pickerOne 和 pickerTwo 实现一个视图。pickerTwo 的值取决于pickerOne 的当前值,因此当用户滚动pickerOne 时,pickerTwo 中的值会发生变化。我已经实现了pickerOne,例如:

仅当用户逐步旋转(一次旋转)时,此代码才能正常工作,但如果用户进行“能量旋转”,则在短时间内多次调用 updatePickerTwoValues。There's a way to intercept when picker stop spinning, so only when spin stop, i can update pickerTwo values?

0 投票
0 回答
70 浏览

android - NumberPicker 缩放给出了奇怪的外观(Nexus 5X)

我的布局中有 3 个 NumberPicker,如下所示:

我的片段 (onCreateView()) 我为这些 NumberPicker 设置了 Y 和 X 比例:

而 Moto G4、Samsung S5 等没有布局问题,但在 Nexus 5X 上有一些垂直的灰线

在此处输入图像描述

如果我删除缩放,就可以了。但我需要用 setScale() 调整大小。
各位有什么解释吗?