Arrow in Timepicker - android

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.

Related

Remove NumberPicker arrows 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 .

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.

What is (s/g)etFreezesText in TextView?

As of recently (probably as a new SDK feature), when I try to pull text from a Textview, I first get the method getFreezesText(), instead of getText().
I looked at the definition of this method and it says
**android:freezesText**
If set, the text view will include its current complete text inside of its frozen icicle in addition to meta-data such as the current cursor position. By default this is disabled; it can be useful when the contents of a text view is not stored in a persistent place such as a content provider.
Must be a boolean value, either "true" or "false".
This may also be a reference to a resource (in the form "#[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type.
This corresponds to the global attribute resource symbol freezesText.
Related Methods
setFreezesText(boolean)
This tells nothing to me.
When we are supposed to use these methods (if ever at all)? Are they new or I've just noticed them?
If you want to force your TextView (or EditText etc. for that matter) to save its state you must add freezesText attribute:
<TextView
...
android:freezesText="true" />
From documentation on freezesText :
If set, the text view will include its current complete text inside of its frozen icicle in addition to meta-data such as the current cursor position. By default this is disabled; it can be useful when the contents of a text view is not stored in a persistent place such as a content provider
The attribute and method have existed since API 1, so I'll say you just noticed it.
android:freezesText="true" will freeze your last completed text.
What is the last completed Text?
Suppose you are showing a textView which is changing after every 2 seconds everything is okay until you rotate the screen and if you rotate the screen the text inside textView will not be visible, here freezesText comes, it will freeze the last showed text (last completed Text).

popup windows in android?

Pretty new to android so excuse me if this is a really obvious question.
Say my application has a bunch of TextViews, each one showing the attributes of a certain product (name, price, etc). I have a button next to each of these TextViews labeled "modify".
How do I make it so that when I press the modify button next to a certain attribute, a popup window with a space to enter text into comes up so that the user can enter text into this box and then have the actual attribute listing on the original page change? Actually I just need a push in the right direction with creating this popup text field... not sure if there is already some built in functionality for this or if not, what would be the best way to create this kind of thing.
Thanks.
Why not have the modify button set TextEdit.setEnabled(true); and then change focus with TextEdit.setFocus? Note that both of these are inherited from view
If you really want a dialog you might want to looking into the AlertDialog.Builder. I know you can use it with buttons and radio buttons, but I'm not sure you can get it to work with a TextView.
Use a code like this for the input popup: Android dialog input text
In the positive button handler, set your edittext content programmatically like this:
myEditText.setText(value).
As simple as that. The only difference with a standard GUI framework is that you don't retrieve the value as a result of the popup function. Instead, you must provide an action handler.

Categories

Resources