Is it possible to remove title bar which I think is ugly and doesn't fit in my application but still use actionbar? After I call
requestWindowFeature(Window.FEATURE_NO_TITLE | Window.FEATURE_ACTION_BAR);
the title bar stays but piece of my view is gone(cant scroll up)
Is it possible to get rid of title bar but still keep actionbar, if I dont request it as window feature getActionBar() returns null everytime..
Following Honeycomb, Action Bar was introduced to provide more functionalities, Well you can hide logo and title from it using this
ActionBar ab = getActionBar();
ab.setDisplayShowTitleEnabled(false);
ab.setDisplayShowHomeEnabled(false);
Related
I am using Custom Action bar. For which the code i am using is -
getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
getActionBar().setCustomView(R.layout.custom_home_action_bar);
ActionBar bar = getActionBar();
bar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(
R.color.color_dark_blue)));
but when I use this code to customise my action bar, navigation drawer icon is not shown. When I comment these lines it is perfectly shown but then I cannot customise my action bar.How can i achieve both?
Thanks in advance
I got the solution. I used
getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME);
instead of
getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
What is the difference between Activity Title and Action Bar Title. Both seem to occupy same area
however activity title is set using
getActivity().setTitle("abc")
and Action Bar Title by
getActivity().getActionBar().setTitle("abc")
Well, there is a difference,
When setting the action bar's title using the setTitle method of class ActionBar will only be displayed if DISPLAY_SHOW_TITLE is set or action bar is present in the activity.
However, the setTitle method of Activity class can be used to set title even when there isn't any action bar for that window.
This really makes a difference when you are using a screen readers such as Talkback or developing an app for users with disabilities. It simply makes your app more accessible.
There is no difference.you can set title using both calls. getActivity().setTitle() is use full to set title in all devices(all API levels)
getActionBar() Call requires API level 11,and its will set action bar text
setTitle() sets Title bar text
My question is stupid I know, but i have no single idea how to solve that problem.
I followed Android API and perfectly made Split Action Bar, without problem.
http://developer.android.com/guide/topics/ui/actionbar.html#SplitBar
But when i decided to remove activity icon action bar drops down under the tabs and i can not find out why.
actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(false);
//actionBar.setDisplayShowHomeEnabled(false);
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setDisplayUseLogoEnabled(false);
actionBar.setTitle("Contacts");
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
After I remove comment (remove Icon respectivaly), tabs get up and bar gets down.
I was developing an app for Android 2.3 where the menu sat nicely at the low right together with the back and home buttons.
I've been using
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
to fully utilize the screen area.
Now, i'm adapting it to SDK>10, and here the menu sits at the top right in the action bar.
Using the above code line hides the action bar, which means I can't see the menu any more.
I could hide the action bar of course by using
ActionBar actionBar = getActionBar();
actionBar.hide();
Where should I put my
ActionBar actionBar = getActionBar();
actionBar.show();
if I'd like to show the action bar by touching the edges of the screen, just like how the software buttons show up?
Regards
/M
I am trying to remove the title from my action bar and reclaim the space it would otherwise consume for the use of menu items.
I have tried using a custom theme but so far nothing has worked. I have tried changing the text size to 0sp, changing the color to transparent, and setting visibility to gone.
I have also tried this :
ActionBar actionbar = getActionBar();
actionbar.setDisplayShowTitleEnabled(false);
I am targeting sdk 15+ and using the standard Android action bar (i.e. not Sherlock).
Thanks for any suggestions.
Here's what I'm talking about (the area bordered in red I want back):
Did you check out the ActionBar documentation yet? There's a method, setDisplayShowTitleEnabled(boolean) that does what you need.
Simply get a reference to your ActionBar, and call that with false:
ActionBar actionBar = getActionBar();
actionBar.setDisplayShowTitleEnabled(false);