I want to hide the action bar of my activity. If I were to do it using android's libs I guess that this line on the manifest would do the job:
android:theme="#android:style/Theme.Holo.Light.NoActionBar"
But I don't want to limit my app for Android 3.0 so I'm using Sherlock Actionbar. What do I have to do to achieve the same effect on it?
Thanks
If you just want to hide your ActionBar use this : getSupportActionBar().hide();
or you can set Theme.Sherlock.Light.NoActionBar as theme of your Activity.
Set Activity theme to one of the following and it will work fine
android:theme="#style/Theme.Sherlock.Light.NoActionBar"
android:theme="#style/Theme.Sherlock.NoActionBar
Related
I watched a tutorial on how to create a custom Toolbar in Android Studio and I saw that I must change Theme.MaterialComponents.DayNight.DarkActionBar to Theme.AppCompat.Light.NoActionBar. I tried to do it and after running an app it showed only a splash screen and then it crashed. Please, someone, help me.
Theme.AppCompat.Light.NoActionBar, No action bar means tool bar cant be created.
Change NoActionBar to LightActionBar or anything else you prefer. then customise the tool bar as you wish to
Try that
Theme.Material3.DayNight.NoActionBar
Instead of Theme.MaterialComponents.DayNight.DarkActionBar
I am learning Android Studio and I made my first app. When I run it, there is a bar (is it a right name for it?) that I don't want (this with three dots on the right). How to remove it? I was trying with changing AndroidManifest.xml android:theme but app started crashing.
http://i.stack.imgur.com/uKJsI.png
In styles.xml, select a theme with no action bar.
For example
Theme.AppCompat.Light.NoActionBar
Also
1) exend your class from Activity instead of ActionBarActivity
2) remove method onCreateOptionsMenu (if present) from your activty
3) remove method onOptionsItemSelected (if present) from your activity
In the Android Manifest change the theme to the following
android:theme="#android:style/Theme.NoTitleBar"
Sorry but i am confused that whether you want to remove the whole bar (ActionBar) or you want to remove the "three dots (menu)" on the right of the bar...
If you want to remove the whole bar then try this:
Put this under your activity tag in android manifest
`android:theme="#android:style/Theme.NoTitleBar"`
and if you want to remove those three dots then "Saeid Yazdani" is right.
Your activity likely extends ActionBarActivity and the OnCreateOptionsMenu method is created by default.
To note, you should put the Activity back into the Manifest and edit the Actvity Java class file.
It is a sample on the book.
I'm trying to hide the action bar by setting the theme to Theme.Holo.NoActionBar:
<activity
android:theme="#android:style/Theme.Holo.NoActionBar"
... >
...
</activity>
However, when I tried this I get the following exception:
You need to use a Theme.AppCompat theme (or descendant) with this activity.
What does this mean? How can I get around this?
I'm new to android programming.
Thanks!
I believe this message is because you're using a compatibility library, or you've set your minimum SDK level too low. Basically the Holo theme didn't exist in the API version you're trying to maintain compatibility with.
ActionBarActivity requires a Theme.AppCompat theme as it assumes you want an Action Bar (hence its name). If you do not want an action bar, your activity should extend from FragmentActivity which contains everything but the Action Bar from ActionBarActivity. Then you can use Theme.Holo.NoActionBar without issue.
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
I am trying to use the ui option: splitActionBarWhenNarrow in my application, but it seems as I am experiencing an unwanted behaviour.
EDIT: Attaching a small gist with some more code.
This is the code in the manifest for the activity:
<activity
android:name="com.example.HomeActivity"
android:uiOptions="splitActionBarWhenNarrow"
android:label="#string/app_name" >
That is the only activity I intent to change the ActionBar style on. In the activity code, I have disabled the actionBar title and icon, so the tabs can merge as the only top action bar.
private void setupActionBar() {
final ActionBar mActionBar = getActionBar();
mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
mActionBar.setDisplayShowHomeEnabled(false);
mActionBar.setDisplayShowTitleEnabled(false);
mActionBar.addTab(mActionBar.newTab().setIcon(R.drawable.tab_one).setTabListener(this));
mActionBar.addTab(mActionBar.newTab().setIcon(R.drawable.tab_two).setTabListener(this));
mActionBar.addTab(mActionBar.newTab().setIcon(R.drawable.tab_three).setTabListener(this));
}
This worked well; however, it seems as if the bottom action bar is not going all the way to the bottom of the activity, but rather just below the top action bar.
Here is what it looks like after the code I wrote, How can I get it to go all the way down, like for instance on the Android's stock messaging app?
Edit, reattaching images.
Here's how it currently look with the code above, and here's how I want it to look.
I have posted a working demo app with tabs and an actiobar at the buttom
Here
Check it out and hope it helps