Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 983
Geeks On Hugs Avatar asked Jul 30 '12 17:07

Geeks On Hugs


People also ask

What is the difference between a toolbar and an action bar?

The Toolbar is basically the advanced successor of the ActionBar. It is much more flexible and customizable in terms of appearance and functionality. Unlike ActionBar, its position is not hardcoded i.e., not at the top of an activity.

How do I replace my action bar toolbar?

To replace an app's default action bar with a Toolbar : Create a new custom theme and modify the app's properties so that it uses this new theme. Disable the windowActionBar attribute in the custom theme and enable the windowNoTitle attribute. Define a layout for the Toolbar .


1 Answers

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.

like image 168
Kevin Coppock Avatar answered Oct 18 '22 06:10

Kevin Coppock