0

I have an application with a single activity and an action bar across the top. I'm using the normal Honeycomb+ action bar with an extended version of the ActionBarCompat example from the Jellybean code examples.

When the user is running the application on a tablet I create a second fragment on the right of the main one. The design mockups that I got from the designer show the action bar only extending across the first pane/fragment.

Is there a way to make the action bar only stretch across the first two thirds of the screen in this case and allow me to have different details on the right side? I've already setHasOptionsMenu to false on the second fragment but this doesn't seem to have any impact.

two pane action bar

The example above shows what the designer wants at the top of the two fragments:

Barry Irvine
  • 13,858
  • 3
  • 25
  • 36
  • Do you mean like the google+ menu? – Warpzit Aug 30 '12 at 09:24
  • Google+ seems to just be one action bar as far as I can see – Barry Irvine Aug 30 '12 at 09:47
  • Yes it does but when you click the home icon you'll have a menu that slides out from the side. I didn't get your question completely so were trying to figure out what you wanted. – Warpzit Aug 30 '12 at 11:32
  • I need the action bar to only extend to 2/3 of screen width so that the search action (and others) clearly relate to the left fragment and not the right fragment. – Barry Irvine Sep 06 '12 at 11:33
  • So what you basically are doing is putting a new screen in but the new screen will only take 1/3 of the screen space. Am I understanding you correctly? – Warpzit Sep 06 '12 at 11:37
  • The screen for the activity is full width. The activity has two fragments: one 2/3 width and one 1/3 width. My question was whether I could make the action bar span only the first fragment (2/3) and have my own content in the second. (Or have some other details on the last 1/3 of the action bar that comes after the action icons). It looks unlikely so I think we're going for a redesign. – Barry Irvine Sep 07 '12 at 12:46
  • I'd recommend to give this link a look: http://stackoverflow.com/questions/8657894/android-facebook-style-slide – Warpzit Sep 07 '12 at 12:51

1 Answers1

0

Don't use the action bar if you want to do this. There is very little room for customization.

Most well-known apps don't implement the action bar at all and use a custom layout instead. It's not hard to do, especially because the dimensions of the action bar are the same on all devices (a fixed height of 48dp).

Dalmas
  • 26,409
  • 9
  • 67
  • 80
  • That may be the way I have to go but to say that an action bar is just a 48dp (mine is actually 50dp) layout is simplifying things a bit. I then have to ensure that the overflow menu symbol is shown and reacted upon when shown as well as handle all the other icons, logos, up-indicators etc. that will be displayed. – Barry Irvine Sep 06 '12 at 11:35