Drop Down Text Display using Android Action Bar - android

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

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.

xml for dropdown text

I have used this forum when I didn't know how to do something, but now I have decided to begin participating in it.
I would like to know how could I do a dropdown text (maybe it has a specific name and that's why I don't find any results on the internet). I mean, I have some tags in the screen (About, Company, Contact, ...). Each of these tags has a down arrow on the right side, and when I click it, it has to display (and hide if it's clicked again).
Here are the links with the images of what I want to do.
http://i45.tinypic.com/4fzoso.png
http://i47.tinypic.com/2u5886q.png
Thank you in advance!
You should use an ExpandableListView component.
There is a tutorial for it here.
Finally I did it with ImageViews and TextViews using the property android:visibility. Now that it's a static version is working properly. I hope that it continues working well when taking the information from the DB

Android Action Bar Two Line Text Labels

Is there a way (perhaps some special character along the lines of non-breaking spaces) that I can force the menu items in my Action Bar to have two line labels? I think this just looks better than long, single-line tab labels...
Thanks,
R.
Edit, additional info: My apologies, I have so far managed to avoid needing the overflow menu, probably because I'm developing for a Nexus 7 with a nice large screen. To clarify, one of my menu tabs (in the action bar proper) is "Restore Defaults", but I think it would look better if it was:
Restore
Defaults
Is there something I can incorporate into my Strings.xml file to force the Action Bar to display the item like that? When I used longer names for all five menu items, "Restore Defaults" DID display on two lines (but it was the only one). Anyway, I know it's possible, just not how to do it on purpose.
Since toadzky does not make an answer of his comment, I will:
Insert a '\n' in the title of your menu item. that should make it wrap.
As soon as he puts it up as an answer, I will delete mine and you can accept his, but this way at least the question can be officially closed.

How can implement search bar in android?

I am working in android. i am trying to display name of university using listView.
my list view is looking like this.
Now i want to add a search bar on the top of this list view. if i press A in search bar then this list view should display all the name of university start with A, if i press some other character then according university name must be displayed.
Please tell me how can implement this. Is any way to make search bar in android. I have seen in iPhone, it works very efficiently in iPhone. Please help me how can make this search bar ?
Thank you in advance...
This may be the long way. but this is just an idea..
I think you have to create a layout xml file with one EditText and ListView. Inside activity you have to listen for textChange in EditText and then probably you have to filter your ListAdapterbased on the text entered by the user and bind it with ListView.
See the complete example here : http://www.androidpeople.com/android-listview-searchbox-sort-items
You can use setTextFilterEnabled(true) on your list view.
I think this may help you to get an idea. http://developer.android.com/resources/tutorials/views/hello-autocomplete.html

Honeycomb launcher title truncated

I am working on my first honeycomb application. The name of the app is fairly long and the launcher title is getting truncated/faded. I'm having trouble finding out whether it's possible to break this into multiple lines so that the entire title is visible. Anyone know?
Thank you.
AFAIK you cannot control how the application label is displayed by the Launcher, that is up the Launcher.
So you'll either have to shorten the name you use as the label for the Launcher, or accept the fading/truncating of your label.
You could try adding a \n at the point where you want a line-break in your String, but I doubt this would have any effect.
Unfortunately there is not a way to prevent truncation of the action bar title. The solution is to make the action bar title short.

Categories

Resources