How do I make a tool bar (like a secondary action bar) in Android?
Asked Answered
M

1

7

The gmail app has this tool bar that looks similar to an action bar (even including an overflow menu). It is a blue bar about 1/4 down the screen. See Image 1:

Image 1

The bar I want is pointed out with a red arrow. I looked through the documentation and didn't see a widget that does this. How can I make a bar like this?

Also if you see the orange arrow below it appears that this app has both an action bar up top and at the bottom. I'm curious how this is done but my main question is how to make tool bar similar to an action bar wherever I want on screen.

Image 1 is on a Phone. I've also included Image 2 and Image 3 below which are a 7" tablet and 10" tablet respectively. Note that the "split" action bar is on a single bar with tablet views.

Image 2

Image 3

Mutule answered 30/7, 2012 at 17:27 Comment(4)
I'm not sure, but it could simply be an ArrayAdapter?Compulsive
Do you mean a list view? I don't think so.Mutule
Have you tried sherlock actionbar actionbarsherlock.com I think you can place that anywhere you want.Pavonine
I haven't yet. I knew about it for having action bars on legacy android devices but didn't know you could do that. I'll look into it! Thank you.Mutule
I
11

For the orange bar, you should simply be able to add this tag to your manifest (under your activity tag):

android:uiOptions="splitActionBarWhenNarrow"

As for the red one, I would imagine it's simply a LinearLayout with a QuickContactBadge, TextViews, and and a few Buttons -- not an actual ActionBar instance.

Imaginative answered 30/7, 2012 at 17:36 Comment(5)
Thanks!...it works like an action bar though...notice the overflow menu. On the orange one...can you force a lower action bar with nothing up top?Mutule
I don't believe you can force one, no. The stock ActionBar will only split if it needs the room. You can certainly fake an overflow menu, though, for the blue bar.Imaginative
OK, and the buttons can be made to look like that...they don't look like buttons. So linear layout with a background color and put some images on it? How would I make it react like a button (hilight and then make click noise)?Mutule
Check out the "People" app...it has a lower action bar and then an upper bar which works as a navigation bar and is a different color.Mutule
You can make a button look like anything. For something like this, I'd use an ImageButton with the src set to, for example, the star image, and set the background to null. Actually for the src, you'd want to make a selector drawable for the different states (pressed, focused, selected, normal, etc.) such as the gold star, empty star, etc.Imaginative

© 2022 - 2024 — McMap. All rights reserved.