numberpicker

Changing NumberPicker divider color

旧城冷巷雨未停 提交于 2019-11-27 07:34:38
On recent android versions, number pickers use a blue divider when drawn (cf. image below). I would like to change this color. Is there a working solution? or perhaps a library that package an updated version of NumberPicker that allows customizing the divider color? I have tried android-numberpicker but I get an error (see below) at runtime due to some code from the library that tries to access to a resource id that does not exist. android.content.res.Resources$NotFoundException: Resource ID #0x0 at android.content.res.Resources.getValue(Resources.java:1123) at android.content.res.Resources

Android NumberPicker: Set min, max, default from XML

无人久伴 提交于 2019-11-27 00:50:11
问题 Is there a way to set the minimum, maximum and default values of a NumberPicker from the XML Layout? I'm doing it from within the Activity code: np = (NumberPicker) findViewById(R.id.np); np.setMaxValue(120); np.setMinValue(0); np.setValue(30); XML is obviously more appropriate , because it defines property, not behaviour. Is there a way to set these using the XML layout? 回答1: I had the same problem, this is how I solved it (according to the comment of MKJParekh): I created my own

how to use number picker with dialog

风格不统一 提交于 2019-11-26 23:02:10
问题 I want to use a number picker for the purpose of getting the discount percentage from the user. once the user enters the sale price, i want a dialog box to appear asking for the discount percentage. I cannot find a way to integrate the numberpicker in the dialog. 回答1: I have made a small demo of NumberPicker. This may not be perfect but you can use and modify the same. Use a custom dialog and set the number picker. More info @ http://developer.android.com/reference/android/widget/NumberPicker

Change the text color of NumberPicker

廉价感情. 提交于 2019-11-26 18:45:46
I've looked at most all of the threads on this and none provided an answer that works. Styling the NumberPicker does not work (as per this thread: NumberPicker textColour ) Setting the style attribute on the numberPicker to a style that has a color item does not have any effect either. Nor does setting the textColor attribute on the numberPicker XML do anything. Closest I've got to this is using the numberPicker to cast its getChildAt() to an EditText and then do setColor() on that EditText, but that only changes the color of the child once upon initialization and then every time it is

Android NumberPicker with Formatter doesn't format on first rendering

笑着哭i 提交于 2019-11-26 16:05:54
问题 I have a NumberPicker that has a formatter that formats the displayed numbers either when the NumberPicker spins or when a value is entered manually. This works fine, but when the NumberPicker is first shown and I initialize it with setValue(0) the 0 does not get formatted (it should display as "-" instead of 0). As soon as I spin the NumberPicker from that point on everything works. How can I force the NumberPicker to format always - Both on first rendering and also when I enter a number

Changing NumberPicker divider color

﹥>﹥吖頭↗ 提交于 2019-11-26 13:45:38
问题 On recent android versions, number pickers use a blue divider when drawn (cf. image below). I would like to change this color. Is there a working solution? or perhaps a library that package an updated version of NumberPicker that allows customizing the divider color? I have tried android-numberpicker but I get an error (see below) at runtime due to some code from the library that tries to access to a resource id that does not exist. android.content.res.Resources$NotFoundException: Resource ID

How to create a number picker dialog?

▼魔方 西西 提交于 2019-11-26 08:07:45
问题 I want to be able to create a Dialog that allows the user to pick a number from a specified range. I know that there are existing widgets(like those from quietlycoding and the one by SimonVT) that already does this but I\'m having hard time integrating those properly into my application. Also, those are primarily widgets. I want something that is very similar to the one in the android developers page tutorials. I also checked the documentation for the NumberPicker and it said to go check the

Change the text color of NumberPicker

和自甴很熟 提交于 2019-11-26 06:34:46
问题 I\'ve looked at most all of the threads on this and none provided an answer that works. Styling the NumberPicker does not work (as per this thread: NumberPicker textColour) Setting the style attribute on the numberPicker to a style that has a color item does not have any effect either. Nor does setting the textColor attribute on the numberPicker XML do anything. Closest I\'ve got to this is using the numberPicker to cast its getChildAt() to an EditText and then do setColor() on that EditText,