Android remove title bar from Action bar - android

I have an activity in my app, which is using swipeable tabs with action bar
For example :-
this tutorial
So my question is to add action bar to my activity and remove titlbar
similar question

I'm unsure as to exactly what you class as a title bar but you could do this in XML by putting the following in your Android Manifest for a particular activity to remove your title bar.
android:theme="#android:style/Theme.Black.NoTitleBar.Fullscreen

Add this to your activity before calling setContentView();
this.requestWindowFeature(Window.FEATURE_ACTION_BAR | Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
if that dosen't work try this
//use this to disable the icon from ActionBar
getActionBar().setDisplayShowHomeEnabled(false);
//use this to disable the application name from ActionBar
getActionBar().setDisplayShowTitleEnabled(false);

Use this code in oncreate() method of activity before adding content:
getWindow().requestFeature(Window.FEATURE_NO_TITLE)

Related

Android fullscreen activity with action bar

what theme should I use to hide the notification bar but show the action bar? (Like calculator on Samsung phones)
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
Use this with Theme holo
**you have to do it through coding add this before setContentView() **

Android custom action bar gobal

I have a problem with the AppCombat.Light action bar. I want to customize my actionbar but I want to reference the layout globaly. Currently I would have to change the actionbar in each Activity like this:
private void setupActionBar() {
getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
getSupportActionBar().setCustomView(R.layout.action_bar_layout);
ImageButton tmp = (ImageButton)findViewById(R.id.action_bar_button);
tmp.setImageResource(R.drawable.ico_nav);
tmp.setBackgroundColor(Color.TRANSPARENT);
}
XML:
But I want to specify the layout parameters in my style sheet. Is this possible?
Currently my action bar looks like this:
but I want an action bar which looks like this:
Now my question is:
Can I customize my aciton bar in a xml file? If so how can I apply it on all activities?
PS: I dont want to edit the action bar programatically!!!
You should create an Activity class and make all of your activities inherit from it. Then you just write your code once.

How to implement drawerlayout with custom action bar?

If i use default actionbar i can set home button to open and close drawerlayout with this code.
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setHomeButtonEnabled(true);
And it's work well.
But i dont't want default actionbar i want actionbar with customlayout.
When i use custom actionbar i don't know how to implement home button for open and close drawerlayout.
How to implement drawerlayout with custom action bar?
PS. I use custom actionbar because i want set title text to align center of actionbar, set text and text size to it's.
EDIT
thank you every body i can solve it's by use this.
getActionBar().setCustomView(R.layout.actionbar);
getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);
it's work well but the home button image change from app logo to app icon.
You can create custom Action bar like this ..
// gets actionBar reference ..
actionBar = getSupportActionBar();
// This sets custom layout to action bar
actionBar.setCustomView(R.layout.action_provider);
// this is how... .... you get id of layout defined
iv_d = (ImageView) actionBar.getCustomView().findViewById(R.id.action_menu);
Now just open you drawer on click of this icon using OnClick()
That's it .. you are good to go.

how to hide action bar in swipe view with tabs

Here's a link
I want to hide the action bar (application title bar)/full screen activity of application how can i do that??
You can hide the action bar by adding <android:theme="#android:style/Theme.NoTitleBar"> to your manifest, or programmatically :
getActionBar().hide();
// with abs
getSupportActionBar().hide();
This link may be helpfull

android: title bar hide

I have this activity made with actionBarSherlock. Is it possible to hide title of activity (not only text but the title bar) I tried:
getSupportActionBar().hide();
but it hides tabs too.
Picture:
https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-prn1/q71/1017267_10200157522600680_915484448_n.jpg
1.You must call setNavigationMode(NAVIGATION_MODE_TABS) to make the tabs visible
getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
2.You must disable the activity title by calling setDisplayShowTitleEnabled(false)
getSupportActionBar().setDisplayShowTitleEnabled(false);
3.You must disable application home affordance by calling setDisplayShowHomeEnabled(false)
getSupportActionBar().setDisplayShowHomeEnabled(false);
This way should able to able to get a look like this in your activity.
try one of these possibly?
add this to the manifest file under application:
android:theme="#android:style/Theme.NoTitleBar"
or in your activity:
ActionBar actionBar = getActionBar();
actionBar.hide();
getActionBar().setDisplayOptions(Window.FEATURE_NO_TITLE);
It worked for me hope it will help you out.
And this will give result like this

Categories

Resources