I would like to ask whether there is a way to put a TextView between the title in the action bar and the tabs in the action bar. It has to be on it's own separate line.
The other way is to implement tabs with the TabHost and put the view above it, but I will have a hard time making tabs look like the tabs in the ActionBar, because by design they have to be like them.
Related
I know the tabhost and tabwidget is deprecated but I have a design where I need to have a Tabhost with tabwidget to launch different activities with tab selection. With this , I also need to have an Action bar at the top depicting normal android's option's menu with search icon and so. Can anyone please provide me with example which is doing this.
So requirements are
1) Tabhost at bottom to launch separate activities with each tab
2) The common action bar for all tabhost's child activities showing options menu.
TIA.
I tried Android action bar with tabs. As you see in this picture:
(source: persiangig.com)
My action bar looks good in phones but in tablets it is not right, the tabs stick left. This picture shows what I mean, how can I put the tabs to center in tablets too?
(source: persiangig.com)
The tabs are aligned left because, in Android, the action bar is used for both navigation and Activity- or Fragment-specific actions. You don't have any in this screenshot, but menu actions that are added to the action bar will be aligned to the right.
If you must have your tabs centered for some reason, you'll have to write your own action bar. I would recommend against this, since it's a lot of work to intentionally go against user expectations. Instead, use Android's built-in action bar layout and design your app to accommodate it.
I have two fragments. One displays my general content (fragment A). The other, fragment B, is displayed over the top of fragment A. I would like for my action bar to have a z-order in the middle of these two layouts. That is, the fragment B would be displayed in front of the action bar.
My question is, is it possible to display a view in front of the action bar?
It is possible.
After all, applications can already display in full screen and not in full screen with the action bar whenever they like. You can set that programmatically yourself in Java.
import android.app.ActionBar;
...
// Show action bar
ActionBar actionBar = getActionBar();
actionBar.show();
...
// Hide action bar
ActionBar actionBar = getActionBar();
actionBar.hide();
Just make sure there is a good reason to alternate this common UI convention on Android.
How can I hide the top Action Bar but show the Split Action Bar using ActionBarSherlock. I would like to have Tabs at the top instead like this:
The Android developer site states the following to hide the action bar but keep the split action bar:
If you'd like to hide the main action bar at the top, because you're
using the built-in navigation tabs along with the split action bar,
call setDisplayShowHomeEnabled(false) to disable the application icon
in the action bar. In this case, there's now nothing left in the main
action bar, so it disappears and all that’s left are the navigation
tabs at the top and the action items at the bottom, as shown by the
second device in figure 3.
https://developer.android.com/guide/practices/tablets-and-handsets.html#SplitActionBar
In my SherlockFragmentActivity I call the following, however only the app icon and title disappear and the action bar stays like this:
//Hide action bar
getSupportActionBar().setDisplayShowTitleEnabled(false);
getSupportActionBar().setDisplayShowHomeEnabled(false);
Calling getSupportActionBar().hide() hides the action bar but also hides the split action bar.
The tabs only roll up into the top action bar if you are using the Tabs provided by ABS. You're not using ViewPager/ViewPagerIndicator for the tabs by any chance are you? (I have this issue currently)
my application contains action bar tab with fragments. it will add dynamically tabs to action bar. when multiple tabs added the text on tab gets wrapped. is there any way to set text in single line only
Take a look at this very useful library to work with ActionBar Tabs in android:
http://actionbarsherlock.com/
Hope it helps you! ;)