2

I have have some problems with devices that have the action bar. When running on a phone I want to go fullscreen with no title bar and no status bar. On tablets I want to show the action bar but still no title bar. Minsdk is 7! The method setTheme doesn't work when you toggle fullscreen so I can't have two themes. Is there a way to show the action bar in fullscreen mode? The support library doesn't support the Action bar.

The only reason I want to do this in the first place is cause they for no good reason at all broke the backward compability by moving the menu key to the action bar. The easy solution for this according to the docs is to add android:showAsAction="ifRoom" to the menu items. But that does absolutly nothing.

I've also tested numerous solutions I found on google that supposedly toggles fullscreen. None of them work on any of my devices so please do not point to something you've read if you haven't used it yourself.

EDIT: I Solved this. The problem seems to be that you have to specify a Holo theme to get the action bar back. Otherwise it won't show. I added this in my main Activity.

@Override
public void setTheme(int resid) {
    if(isTablet(this))
    {
        super.setTheme(android.R.style.Theme_Holo);
        return;
    }
    super.setTheme(resid);
}

1 Answers1

2

On tablets I want to show the action bar but still no title bar

The action bar replaces the title bar. There is no concept of an activity having an action bar and a title bar.

Is there a way to show the action bar in fullscreen mode?

AFAIK, no, by definition.

The support library doesn't support the Action bar.

ActionBarSherlock provides a backport of the action bar for API Level 7 and higher.

The easy solution for this according to the docs is to add android:showAsAction="ifRoom" to the menu items. But that does absolutly nothing.

It certainly "does nothing" if you have no action bar. If you want a fullscreen experience, then you will need to roll your own menu replacement. IMHO, most fullscreen apps did this already (e.g., a game going with a game-styled "menu").

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • The title bar was not replaced by the action bar. I can get the title bar to show. You confused it with the status bar I presume. I'm not gonna add any third party things. I rather drop the tablet support. And your last statement. I actually thought it would appear in the system bar as the short version of the docs state that you only have to add the attributes to your menu items to add tablet support. It did already work in the action bar when I set the theme to show it (in the manifest). So what's the solution? Go third party or drop it? –  Sep 25 '12 at 00:11
  • 1
    @Fdk2000: "The title bar was not replaced by the action bar" -- yes, it is, on API Level 11 and higher. "I actually thought it would appear in the system bar as the short version of the docs state that you only have to add the attributes to your menu items to add tablet support" -- only if you have an action bar. The only way the menu appears in the system bar is if your `targetSdkVersion` is less than 11. – CommonsWare Sep 25 '12 at 11:01