Search code examples
androidandroid-actionbaractionbarsherlock

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.


Solution

  • 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.