1

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?

MM.
  • 4,224
  • 5
  • 37
  • 74

1 Answers1

1

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.

Stephan Branczyk
  • 9,363
  • 2
  • 33
  • 49
  • 2
    That hides the ActionBar; however, I am wanting to overlap the bar (partially, or completely). – MM. Mar 25 '13 at 21:13
  • Yes, if you want to partially overlap it, you'll probably want to make a transparent Activity that you place on top of it. – Stephan Branczyk Mar 25 '13 at 22:26
  • 1
    It is not possible to display an activity over another. Rather, I can layer a fragment on top of my main fragment. The question is, how do I ensure that the top level fragment is indeed at a higher z order than the action bar. – MM. Mar 25 '13 at 22:57
  • http://stackoverflow.com/questions/2176922/how-to-create-transparent-activity-in-android/2700683#2700683 – Stephan Branczyk Mar 25 '13 at 23:04
  • Actually, a z-order thing might be possible as well with the animation framework, I remember seeing a presentation by Chet Haase. I'm just a bit fuzzy on the details. I'll have to look it up. – Stephan Branczyk Mar 25 '13 at 23:06
  • Here is one way to do what you want from Chet Haas. Chet works at Google and wrote the android animation framework. https://www.youtube.com/watch?v=Ho8vk61lVIU Chet also has other easier ways you can do the same thing at higher api levels. It's just that I don't have the time to look through all of his presentations/youtube videos. – Stephan Branczyk Mar 25 '13 at 23:30
  • @MM. Did you ever find a way to do this? – Matt Robertson Nov 26 '14 at 22:40