numberpicker

Custom NumberPicker buttons.onClickListener

一曲冷凌霜 提交于 2019-12-11 04:49:30
问题 One of my activities requires a list view with custom number pickers in each row. I created the number picker as suggested here. When I click on the buttons, however, the counter doesn't increment or decrement at all. The following is the code found at my Custom ListView Adapter. public class MaterialListViewAdapter extends BaseAdapter { ViewHolder holder; int counter = 0; private ArrayList<MaterialClass> data; public static LayoutInflater inflater = null; public static Dialog dialog; String

How to customize the NumberPicker

蹲街弑〆低调 提交于 2019-12-11 04:17:21
问题 I found 2 built-in NumberPickers: (source: techbooster.org) By default, it's the first one, but when I add android:theme="@android:style/Theme.NoTitleBar" in AndroidManifest.xml, it becomes the second one. How can I put this line (I need it) and still get the first NumberPicker? 回答1: you are setting the non holo theme so you get the non holo numberpicker. see this as reference, its basically the same thing you asked Remove titlebar in xml 回答2: The problem is that @android:style/Theme is the

Is it possible to change the increment of NumberPicker when long pressing?

坚强是说给别人听的谎言 提交于 2019-12-11 02:29:57
问题 I have range of 3900 numbers which the user use the NumberPicker to pick one single number from. Now, when long pressing up/down arrows in the picker, the numbers are increased/decreased slowly. I have sat the setOnLongPressUpdateInterval() to 0 milliseconds, but it still increment slowly in this large range of numbers. Is it possible to change the increment in the picker when long pressing the up/down arrows so it increases numbers by lets say 100, and turns back to increment of 1 when

number picker doesn't show values

爷,独闯天下 提交于 2019-12-10 23:25:35
问题 I'm using some number pickers from a xml-file in a alert dialog to get some coordinate inputs. The pickers are created and have some values (when you mark it and the keyboard opens you can see them), but won't show other values and the displayed value has the same color as the background. When I press the OK-Button, the (more or less) displayed values are given correctly to the activity. My Code: public void showDialog() { final Context context=getApplicationContext(); final AlertDialog

How do i skip some number from number picker?

☆樱花仙子☆ 提交于 2019-12-10 21:13:51
问题 Number picker np = (NumberPicker) findViewById(R.id.numberPicker1); np.setMaxValue(200); np.setMinValue(1); Button b = (Button) findViewById(R.id.button1); when I scroll numbers should go 1 2 3 ... etc .. what I want is when scrolling its should go 5 10 15 etc how to do it ? 回答1: This code snippet should fix your problem; NumberPicker np = (NumberPicker) findViewById(R.id.numberPicker1); String[] numbers = new String[200/5]; for (int i=0; i<numbers.length; i++) numbers[i] = Integer.toString(i

NumberPicker textColour

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-10 18:07:47
问题 I have a ListView containing a TextView and a NumberPicker for each row. Whenever I start up the activity, the numbers of the NumberPicker are white (the same color as the background). I tried applying a style as suggested here, here, and here ; to no avail. Any other suggestions? - NumberPicker.xml <NumberPicker android:id="@+id/npMaterialAmount" android:layout_alignParentRight="true" android:layout_width="wrap_content" android:layout_height="75dp" style="@style/npColour"/> - Tried style 1:

How to use NumberPicker in Android app with API 7?

被刻印的时光 ゝ 提交于 2019-12-10 13:22:37
问题 The minimum sdk of my app is 7, but I can use DialogFragment which is from sdk version 11, because it is in the support library which is in my lib directory. I'd like to make something like this example: http://developer.android.com/guide/topics/ui/controls/pickers.html But I want to use the NumberPicker widget, which is from sdk version 11 too, but my app does not allow this. Do I have to add other support library? How can I use this component? Thank you. 回答1: Do I have to add other support

How to change Number Picker center text color in Android

烈酒焚心 提交于 2019-12-10 03:59:28
问题 I have implemented a custom Date Picker wherein I need to have custom colors for the number picker (Date picker uses Number picker inside) inside it as follows: With the help of this answer I could make it look like this: But as you see the actual date is getting shown in the yellow color instead of white. Moreover, I tried doing it at run time like this: npMonth.setOnValueChangedListener(new OnValueChangeListener() { @Override public void onValueChange(NumberPicker picker, int oldVal, int

NumberPicker rendered incorrectly in a Dialog

走远了吗. 提交于 2019-12-08 08:21:51
问题 I have a NumberPicker inside an AlertDialog instantiated like this: final NumberPicker np = new NumberPicker(PiattoActivity.this); . The problem is, instead of being rendered like this (on the left): it's rendered like this: Why the dividers take up all the space given? How can I fix it? 回答1: You are using for the picker android:layout_width="match_parent" You should use android:layout_width="wrap_content" android:layout_gravity="center" 来源: https://stackoverflow.com/questions/23857623

How to get value of the NumberPicker instance from onValueChange when The NumberPicker not scrolling only(pressing plus or minus buttons) in Android

烈酒焚心 提交于 2019-12-08 03:24:45
问题 I have a NumberPicker instance and it works as expected but I need to get value form it when scrolling stops Or when the user only press increments / decrements Button is pressed. the value that i should get it are displayed in the text view. i managed to get the value when scrolling stops/ became idle and displayed correctly(this done in onScrollChanged() listener). but the onScrollChanged() listener won't be fired when user press on increments or decrements buttons and if I use