Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Position view below action bar with overlay

I would like to position a view below an action bar with overlay. Is there a way of doing this via XML layout?

I would like to avoid using constants as there are already at least 4 possible values and that number is likely to grow.

Compatibility with ActionBarSherlock is a plus.

like image 985
hpique Avatar asked Jul 10 '12 18:07

hpique


People also ask

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

An Action bar is traditionally a part of an Activity opaque window decor controlled by the framework but a Toolbar may be placed at any level of nesting within a view hierarchy. The toolbar provides more feature than ActionBar . A Toolbar may contain a combination of elements from start to end.

Which view can be used to customize the action bar?

Custom Action Bar Layout The view layout consists of two ImageButtons that represent forward and back image buttons and a TextView in the center.

How do I customize my action bar?

This example demonstrate about how to create a custom action bar in Android. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml.

What is a toolbar on android?

android.widget.Toolbar. A standard toolbar for use within application content. A Toolbar is a generalization of action bars for use within application layouts.


1 Answers

android:layout_marginTop="?attr/actionBarSize"

This will account for changes in size based on screen configuration automatically. You can see a demo of its use in the "Overlay" example of the 'Demos' sample that comes with ActionBarSherlock.

like image 118
Jake Wharton Avatar answered Sep 20 '22 14:09

Jake Wharton