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.
Related
I am looking to achieve the functionality of an AutocompleteTextView but slightly different. Instead of getting a drop-down list with suggestions i want it to complete the sentence for me.
For example: i type abc and i get completed, with the rest of the text in grey: abc1#etc.etc and then click a button to keep this text or keep writing to filter this even further.
Do you think is is achievable somehow?
I have looked my problem up so far but all the answers i found involved a drop-down list, perhaps i haven't looked deep enough.
Why don't you try to implement a custom view?
Basically, you need to the same things that the AutoCompleteTextView does but instead of displaying N elements into the drop down list you have to add the first option to your EditText.
Have a look at:
TextWatcher in order to see how detect the user input and progress
You can then play with indexes and spannables in order to keep track of the data input by the user and the data that you are suggesting.
One thing that I don't like about this idea is the fact that if you have got:
Germans
Germany
...
You need to type a lot of letters without the possibility to choose something different from the solution that you are providing.
use below example ... i think help you...
http://teamandroid4u.blogspot.in/2012/06/autocompletetextview-example.html
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.
Can anyone point me to an example of displaying text in a view that "unrolls" down from the Android Action bar when the corresponding item is touched?
In my case, I want to display GPS state information such number of visible satellites, but that's not really important, it's just text data. The distinction, in this case, is that I don't want to display a drop-down menu, just text data -- that changes over time, but has no function.
I'll keep searching, but at this point, I'm not even sure what to use for a search phrase.
Thanks,
R.
I got some assistance at one point with how to add a spinner to my ActionBar. The spinner display DOES allow me to temporarily drop below the "normal" Action Bar space, but I don't know how to fix its label at the top. Does this make any sense? If could use a spinner without losing the Action Bar label, it would probably be perfect. Does anybody know how I might do that? Does anybody think I probably should have opened a separate case??
Thanks, R.
Try this...
View customeView = getLayoutInflater().inflate(R.layout.custom_action_bar_layout, null);
getActionBar().setDisplayShowCustomEnabled(true)
getActionBar().setCustomView(addView);
Also refer: https://groups.google.com/forum/#!msg/android-developers/mDUJ1yYcVPQ/ATwHNLg1OA0J
I am new to android. I was stuck on a problem but I finally solved it.
I was using a TextField instead of CompleteTextViewField so whats the difference between these two and when should I use each one of them?
Thanks
Neither of those classes you mention (TextField, CompleteTextViewField) exist. Do you mean EditText and AutoCompleteTextView? I think the documentation explains it pretty well:
[AutoCompleteTextView is] An editable text view that shows completion suggestions automatically while the user is typing. The list of suggestions is displayed in a drop down menu from which the user can choose an item to replace the content of the edit box with.
That is, use it rather than a normal EditText if you have a set of common autocompletions for what gets entered in the box. The docs also link to a full sample that shows how to populate that list of suggestions with an Adapter.
I need to implement - for my Android app - two user controls quite similar, and very close each other in the UI layout: a single selection control, and a multiple one.
I know the Android solution is to use a Spinner (for single selection) and a ListView (for multiple selection).
I ask: is there a way to let them look more visually similar? By default, a Spinner has a down-arrow symbol on the right, which a ListView has not. And, the Spinner is dismissed on an item selection, while the ListView must be closed with the [back] button on the phone.
I just don't want to confuse my user: I feel (and suppose users, too) that the attribute "single/multiple" selection doesn't account for such a different UI and usage...
I do accept Raggedtoad solution: I will stick with the Android convention of using a Spinner and a ListView separately, though I find this solution quite sub-elegant... :-)