Displaying different text on a spinner item than the selected text, android - android

I have a spinner item, with three elements, say
i) A - one
ii) B - two
iii) C - three.
When the user presses the spinner, the drop down box displays these
elements, but when one of them is selected the only text that should be displayed
is the character, say A (like an index).
I can't seem to find anything useful except using "android:promt" to display a
legend indicating what each character/code stands for but this looks unprofessional
and confusing to the user.
Is there anyway I can do this using android?
If anyone can help me, thanks in advance :)

Related

Android Spinners with different Display text from the list values

I'm playing around with Android spinners. I'm not 100% sure if I can get the behavior I want using a spinner, but it's the most obvious choice that comes to mind.
I need something of a dropdown view, the title of which says "x of y selected".
The options in the dropdown would look like:
-All
-None
-Special items only
On clicking one of the dropdown items, the title is reconfigured such that 'x' changes.
It would be ideal to use a spinner, but somehow, it seems that android puts in the first value of the spinner to always be the first values in the list of strings you pass it, and I clearly don't want the title item to be shown in the dropdown list for my case.
Another approach that I came across was to perhaps use a button with a popup with these items in the popup.
Would that be a better approach, or can I actually achieve the behavior using a spinner, or is there another view that would better serve my purpose?
I'm going to redirect to this post, after a lot of searching I found what I was looking for:
How to hide one item in an Android Spinner
The answer by Aebsubis, and make sure to set the text view height to 0. I'll update this answer with more code, once I'm done with tweaking it for my purposes.

Android ExpandableList Header with spinner

I'm developing an application and I am facing a problem using ExpandableListView. What I'm trying to do is, in GroupHeader, not only show the group name, but also an spinner with options. That's because I want to show the football second division games in the list but, also, give the option to choose the round, in case the user wants to check older/future games. SO far I have that
As you can see both, title and spinner, shows. Also you can see the arrow on the right which is supposed to expand the list. Problem is that, if I click, only spinner opens, group expand button doesn't. So, here is my question, how can I make both of them work depending on where you click (one or another)??? Is that possible?
Also I must say that if I only place the TextView with the group name works perfect. If I only place the spinner, the problem persists. So I'm guessing that's a focus problem.
Btw: grey areas are the layout backgrounds, so no, they are not hiding behind the button.
I found the solution, I just neede to add this line android:descendantFocusability="blocksDescendants" to the Main Layout of the xml where I define the GroupHeader elements.

Suggestions for data entry form in android

I am working on app which have data entry form which have
Some fields with 3 drop down associated to it.
More then 25 input fields (input box, radio button, drop downs etc)
All input fields are grouped into 3 categories
My question are:
How to display field with 3 drop downs associated with it ? Because of a small screen size it cannot be displayed horizontally.
What is the best way to represent 25+ fields ? I tried scroll view and tabs but don't find it so pleasing.
For example if you consider date then it may have three drop downs for date , month and year. (Its just example I have fields different than date)
What is the good way to have fields in a category together with appealing UI.
PS: My app is related to Hospital so it has to be pleasant .Which also means I cannot use glossy background or image.
You might want to check this site for general Android UI design ideas. Here are some for your particular cases:
re-design your UI to only show what is needed. It's unlikely that all 25 fields are used all of the time. Consider separate screens for different use cases, and/or some sort of wizard-like UI (fill in the basics, press next, fill in details, etc.)
if you really need to display all of this, consider using a tablet, not a phone to run the app (assuming this is to be used in the field, and you have some control over devices).
instead of tabs, you might want to try something like ViewPager. It doesn't take as much space as tabs, and the number of views is practically unlimited.
Maybe like this...
You can use the library QuickAction which allows to create some kind of context menu.
To keep a simple screen view, you can only display the current values. Several on the same lines for the same category.
Then, if the user click on a value or category, you trigger a QuickAction with the actions available for the category or values: Edit, clear, ...
For each action, you can also show a dialog to update/fill the field which has triggered the action...

UI Component for Launching ListView with onActivityResult

I have this SearchMenuActivity that has a bunch of options the user can select. Two of the options fires an intent to a ListView where the user can select a value and then it reports back to the SearchMenuActivity. I also have another option like this except it allows the user to select multiply options. The problem that I am having is choosing a UI component that will launch the ListActivity and hold the results when it reports back via onActivityResult. I have come up with a couple solutions here they are ...
Solution 1
Use a button which default text is "Choose item a". This will launch the ListView and then when the user selects an item the text of the button will become the selection.
Solution 2
Use a spinner. The problem with this is that spinners do not support multi selection items. It would also complicate things because the items in the list view are being pulled from a server backend and displaying a loading message on top of the spinner would look ugly.
Solution 3
Have a clickable textview which default text is "Click here to select item". This will launch the ListView and then when the user selects an item the text of the textview will become the selection.
Right now I am implemented solution 3. The "Click here to select item" seems intrusive. Anyone have any ideas as to what is the best method to solve this problem?
Option 3 is the best
However it is not very nice for changing his choice. I think you must add a small icon to the right of the TextView that allows the user to re-select.

Listview, single choice in touch screen?

Goal: have a LIstView show a list of text strings. The user can select an item by touching it. The selected item is visibly different to those not selected.
In short I want to have a simple scrolling list box that works using trackballs AND touch mode.
There are many posts asking for this, but none seem to get an adequate answer. This is such a simple requirement, why is there no article on this?
I looked at http://developer.android.com/resources/tutorials/views/hello-listview.html but that won't work in touch mode: the orange background is displayed, something unachievable in touch mode without extreme geek wizadry, for something that is quite frankly what all newbies expect out of the box.
I suspect that the only way to achive a touch mode selectable listbox (ListView in google speak), is to stick radio buttons in there. All of a sudden my little text list view is beccoming a monster.
Can anyone explain the simplest way to do a single choice ListView that displays the item selected so the user can figure out that it is selected, in touch mode? After fumbling for days, I really am not fussed if it has radio buttons, singing cockatoos, or whatever, so long as it's simple to code.
Here's the example that Google provides:
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List10.html
It uses radio buttons
Wat do u want to do? Just highlighting the row in the ListView which is selected.rt? for this u can use this.
android:listSelector="#drawable/highlighter"
android:drawSelectorOnTop="true"
Write this code in your XML file

Categories

Resources