numberpicker

Call requires API level 29 (current min is 21): `android.widget.NumberPicker#setTextColor`

我与影子孤独终老i 提交于 2021-01-04 05:31:24
问题 I want to change selected field of text color using setTextColor. But Android Studio gives me this error. What should I do? Min SDK is 21. This is code of my CustomNumberPicker class: import android.annotation.TargetApi import android.content.Context import android.graphics.Color import android.graphics.Paint import android.graphics.Typeface import android.graphics.drawable.Drawable import android.os.Build import android.os.Build.VERSION import android.os.Build.VERSION_CODES import android

Android Numberpicker default value not coming

安稳与你 提交于 2020-01-28 09:30:25
问题 When the numberpicker is loaded, the default value is not appearing on the screen until touched. Once touched, everything works fine.Any help appreciated. Also if the formatter is removed, it works fine. dialog.xml <NumberPicker android:id="@+id/number_picker" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <Button android:id="@+id/apply_button" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/number_picker"

Android Numberpicker default value not coming

谁说胖子不能爱 提交于 2020-01-28 09:29:47
问题 When the numberpicker is loaded, the default value is not appearing on the screen until touched. Once touched, everything works fine.Any help appreciated. Also if the formatter is removed, it works fine. dialog.xml <NumberPicker android:id="@+id/number_picker" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <Button android:id="@+id/apply_button" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/number_picker"

How to setOnValueChangedListener from NumberPicker inside a BaseAdapter

牧云@^-^@ 提交于 2020-01-11 07:52:08
问题 I am trying to create a BaseAdapter which each element has a NumberPicker and a Button. The button's action parameters depends on the value picked in NumberPicker. One solution I thought was creating a setOnClickListener (of the button) inside the onValueChange of the NumberPicker, the problem is onValueChange never gets fired when I change the number. I leave you the code to make it clearer: public class Adapter extends BaseAdapter{ ... public View getView(int position, View convertView,

Android NumberPicker wraps values when displayed values are changed

对着背影说爱祢 提交于 2020-01-03 09:00:13
问题 I have an android Dialog with a 3 numberpickers inside. Changing the 3rd picker triggers a change in the displayed values of the first 2 pickers . However I've noticed when I change the displayed values, and call setWrapSelectorWheel(false) it still shows the new values as wrapped visually (I can see the last value above the first one). If I touch the picker it suddenly snaps into non wrap selector wheel. What's odd is I call getWrapSelectoWheel() after setting the displayed values and it

android numberpicker for floating point numbers

二次信任 提交于 2019-12-31 22:34:14
问题 The user of our app should be able to adjust a floating point number. At the moment, I filled an ArrayAdapter with all possible values and attached it to a spinner. This solution doesn't really meet our expectations, since the spinner dropdown box is way too tall. Is there a better way? I was looking at Numberpicker - but this seems to work only with Integer values. Any ideas? Thanks! 回答1: NumberPicker is not just for integers.. Even you can use Floats String etc. see this and read about it.

NumberPicker doesn't work with keyboard

末鹿安然 提交于 2019-12-31 02:25:07
问题 In activity_main.xml : <NumberPicker android:id="@+id/numberPicker1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/textView2" android:layout_centerHorizontal="true" android:layout_marginTop="30dp" /> In MainActivity.java inside the oncreate : NumberPicker numberPicker1 = (NumberPicker) findViewById(R.id.numberPicker1); numberPicker1.setMinValue(1); numberPicker1.setMaxValue(20); When I edit the value with the keyboard, the value that I get

How do I align text view to be in center (vertically) of two NumberPickers?

懵懂的女人 提交于 2019-12-25 06:38:36
问题 I would like to align a TextView containing ":" between two NumberPickers, I would also like it to be on top of the NumberPickers so that it is not 'pushing' the NumberPickers to the side. Currently this is my XML for the LinearLayout containing the NumberPickers and TextView: <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_below="@id/timer"> <NumberPicker android:id="@+id/numberPicker1" android