Show tab bar and listIn Actionbar at same time. (Android Honeycomb) - android

There is a situation in which I want to use Tab bar as well as List navigation, Both at same time in Action bar.
Documentation says 'we can put Actionbar in to list navigation mode or tabs navigation mode'.
Is there any way to use both at same time. Any pointers, help. Thank you in Advance.

Sorry, you can only have one or the other.
That being said, you can use android:actionLayout to convert an options menu item into a custom inflated layout in the action bar. You might be able to use the "tabs navigation mode" while putting your own Spinner to the right of the tabs this way. Personally, I would find this confusing as a user, but perhaps it will work for your use case.

a very late answer, but this is possible by a simple hack. You just have to replace (programatically) the view that is pointed by android.R.id.action_bar_title with a Spinner. I wrote a blog about it. Here's the link

Related

How to position the elements in a custom action bar layout in Android?

I need to develop a custom layout for the action bar in Android.
I'm now stuck because I have no clue how to calculate the available space for my custom layout.
In the image, the red part is my custom layout, the blue part is the space occupied by the action buttons.
Clearly I need to know/calculate the size of the red part to be able to correctly position the elements in my custom action bar (for example center the title in the window or make sure not to overflow in the blue part).
How can I achieve this?
I couldn't find useful examples or a clear API in the Android documentation.
I think that anyone using the custom action bar layout must be facing this kind of problem, I'm a bit confused.
Or am I supposed not to use action buttons in this case? Perhaps I'm supposed to replicate the action buttons by myself?
Thanks in advance
Try using ToolBar instead of ActionBar. It will give you a lot more control over ActionBar elements than ActionBar.
Here is a simple tutorial about how to replace ActionBar with ToolBar and how you can customise it.
Material ToolBar
Possibilities are endless with ToolBar but my recommendation is to don't overdo anything.
As per my suggestion try to use the entire action bar by your custom layout. So that you can arrange all the things use it as a fragment inside a framelayout for all your screens so that the code can be reused for all your layouts.

ActionBar in android at bottom

I want to put an action bar with 4 clickable entities, on the bottom of the activity. I should be able to associate each of the 4 entities/buttons with intents. Can anyone please tell me the xml file and the java code for this. I am not able to find this anywhere.
You can try a SplitActionBar but in general it is recommended that the ActionBar be at the top and contactual actions go in the bottom bar.
Alternatively you can try playing with the gravity layout parameter as shown here, though I have not tried this and would advise against it.

Activity/Fragments & Action Bar

I'm really new to Android and I want to implement listview and tab action bar:
Home page:
A list that has action bar on top with two tabs (swipe left/right).
The items in the list are clickable.
Detail page:
One of the tab will just have some content
The other is another list with unclickable items
What should I use?
A listview activity or a listview fragment for the home page?
Or does anyone know of an example that is similar to this?
I don't care about backwards compatibility (for now)
Thanks in advance!!
I think this Android Developers' tutorial is pretty self explanatory. You should be able to figure it out from that.
I'd suggest you go with fragments as they're the newest way; whereas activities are getting old now. This will make it easier for your application to accommodate future Android updates.
This may also help you out regarding Fragments.

Action bar list navigation + tab navigation - Position of spinner is not at left most

According to Jake as in Android layout with action bar and tabs, we decide to follow his 2nd suggestion.
Use tab navigation in the action bar and set a custom view with a Spinner
Together with IcsSpinner from ActionBarSherlock itself, we manage to make it work in Gingerbread and ICS both.
However, we still suffer the following problem, during landscape mode.
Note, the spinner ("Portfolio 1") is in between PORTFOLIO tab and search icon. What we want is, the spinner is at the left side of WATCHLIST tab.
Is there anything we may try out?
Thanks.
You can set custom view for your action bar, user RelativeLayout to put your spinner at left side of "WATCH LiST"
in java code: actionBar.setCustomView(R.layout.custom_actionbar_layout)
a very late answer, but this is possible. You just have to replace (programatically) the view that is pointed by android.R.id.action_bar_title with a Spinner. I wrote a blog about it. Here's the link

Can i show Tabs without Action Bar in android 3.0?

I want to show tab in my fragment but not on Action Bar?
Is this possible, any link or code might help??
Thanks in advance
I got the tabs without the rest of the ActionBar by removing the home button and the title, like this:
actionBar.setDisplayShowHomeEnabled(false);
actionBar.setDisplayShowTitleEnabled(false);
and not overriding:
onCreateOptionsMenu
That way the ActionBar would be empty and Android won't display it.
You can use the tabWidget. In a part of my application, I have a TabActivity where the inner activity uses fragments. So, it is possible. It may not be the best solution, but I had to do what the customer wanted.
It depends what kind of tabs you want to use. In my app I'm using ViewPager together with indicator and it works great, so maybe it will suite you. I hope I've understood your question.

Categories

Resources