Remove NumberPicker arrows Android - android

Is there a way to remove the NumberPicker UP/DOWN arrows?
I googled but I wasn't able to find any method.. I have 2 devices one with android 4.2.2 and one with 4.0.3, in the first one the NumberPicker is scrollable and has no arrows while in the second one the NumberPicker isn't scrollable and has the up/down arrows

Quoted from the android documentation class overview:
In your older device you get this one.
If the current theme is derived from Theme the widget presents the current value as an editable input field with an increment button above and a decrement button below. Long pressing the buttons allows for a quick change of the current value. Tapping on the input field allows to type in a desired value.
Whereas what you desire is this flavour of the widget:
If the current theme is derived from Theme_Holo or Theme_Holo_Light the widget presents the current value as an editable input field with a lesser value above and a greater value below. Tapping on the lesser or greater value selects it by animating the number axis up or down to make the chosen value current. Flinging up or down allows for multiple increments or decrements of the current value. Long pressing on the lesser and greater values also allows for a quick change of the current value. Tapping on the current value allows to type in a desired value.
This would seem to be from a compatibility issue due to android version. Check what minimum version of android your Holo derived themes use in your app. It may be that the theme your older 4.* device is not accessing the same theme, but one that shares many similarities.

I think you should create your own number picker and inflate it.
You can follow this tutorial on inflating elements .

Related

Android Custom number picker issue

I am building a library with a NumberPicker and two buttons which controls the Up and Down of the number. I set the min and max to the NumberPicker with setMin, setMax, setValue and after that I set an ordered array in the setDisplayValues method.
I've built an example with the component isolated, and its working fine.
But when I try to use my component inside my app, the component doesn't work as expected. When the component is showed, the value limit is not the correct value. When I refresh the value, moving the picker, it sets to the proper value, and everything works fine. But the first time is not working as expected.
I tried to put the NumberPickerisolated in the app, an the result is the same. Any idea?
In the image where you see 14 down...there is suppose to be nothing. In the other 14 is suppose to be a 1. The max value for the picker is 14.

Arrow in Timepicker

I have a timepicker showing the choice, but also shows the previous option above, and the next option below. I wish they would show these options are not, and it would show arrows such as in the image attached: http://www.subirimagenes.net/i/140728103732203512.png.
I have searched but have not found any solution.
From android/widget/NumberPicker.java:
If the current theme is derived from android.R.style#Theme the
widget presents the current value as an editable input field with an
increment button above and a decrement button below.
If the current theme is derived from android.R.style#Theme_Holo or
android.R.style#Theme_Holo_Light the widget presents the current value
as an editable input field with a lesser value above and a greater
value below.
According to this, before Holo the widget looked exactly how you wanted it. So try adding android:style="#android:style/Theme.Black" inside the <TimePicker /> in your layout xml file.

Android Hide TimePicker numbers?

Is there a way to hide these numbers? Im guessing there must be an attribute which once set to 'false' should to it.
Also, i've tried to use custom drawables for the the up/down arrow, but those seem to overlay on top of the numbers (ie,the numbers are still visible)
Note: I could make custom pickers where I use a textView in between two imageViews, but the default timePicker allows one to swipe up and scroll through numbers (so would prefer using the default)
Edit: Apparently the NumberPicker has different children in different versions of android(the emulator shows the up/bottom arrows, while on my Samsung Tab they return a nullpointerexception). Wow!
Instead of using a time picker you could try and use a number picker instead, this means that you can specifically set what you want to be in the picker.
Is there a way to hide these numbers?
No, sorry.
Im guessing there must be an attribute which once set to 'false' should to it.
Only if you fork TimePicker and add such an attribute yourself.

same code for NumberPicker looks differently on different projects?

Help! in the first project the NumberPicker behaviour is that you can change the number by pressing + or - while in the second project the NumberPicker has 3 numbers and every time you roll it, the middle number changes to the correct one. Both projects use the same NumberPicker code!!
The behavior and appearance of NumberPicker depends on the theme that is in effect. From the docs for NumberPicker:
If the current theme is derived from Theme the widget presents the current value as an editable input field with an increment button above and a decrement button below. Long pressing the buttons allows for a quick change of the current value. Tapping on the input field allows to type in a desired value.
If the current theme is derived from Theme_Holo or Theme_Holo_Light the widget presents the current value as an editable input field with a lesser value above and a greater value below. Tapping on the lesser or greater value selects it by animating the number axis up or down to make the chosen value current. Flinging up or down allows for multiple increments or decrements of the current value. Long pressing on the lesser and greater values also allows for a quick change of the current value. Tapping on the current value allows to type in a desired value.
You evidently have different themes in effect for the NumberPicker in the two projects. More information is available in the Styles and Themes guide topic.

Number Picker as present in Dialog (Android)

I am trying to implement NumberPicker in my application. I want the view to be as show in
Dialogs Guide,which is
what i get when i implement the number picker
Also, i do not want to have text selected when i tap on selected item, from scroller
P.S. I tried searching around google and SO, but could not find correct answer for my question
I implemented solution provided here at SO.
Have already defined listener for value changed.
Tutorial/Guide is here, it just a quick overview of NumberPicker widget.
I want to implement view similar to
I think that depends on theme used
See NumberPicker at developer.android.com
Class Overview topic:
A widget that enables the user to select a number form a predefined range. There are two flavors of this widget and which one is presented to the user depends on the current theme.
If the current theme is derived from Theme the widget presents the current value as an editable input field with an increment button above and a decrement button below. Long pressing the buttons allows for a quick change of the current value. Tapping on the input field allows to type in a desired value.
If the current theme is derived from Theme_Holo or Theme_Holo_Light the widget presents the current value as an editable input field with a lesser value above and a greater value below. Tapping on the lesser or greater value selects it by animating the number axis up or down to make the chosen value current. Flinging up or down allows for multiple increments or decrements of the current value. Long pressing on the lesser and greater values also allows for a quick change of the current value. Tapping on the current value allows to type in a desired value.

Categories

Resources