I have this layout code which I thought was correct:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="64dip"
android:background="@drawable/title_background">
<ImageView
android:layout_width="48dip"
android:layout_height="48dip"
android:layout_margin="8dip"
android:src="@drawable/title_icon" />
<ImageView
android:layout_width="128dip"
android:layout_height="32dip"
android:layout_margin="16dip"
android:src="@drawable/title_text" />
</LinearLayout>
The LinearLayout has a height of 64dip and the first ImageView has a height of 48dip. From the math I learned a long time ago a margin of 8dip would match perfectly. But it doesn't as my ImageViews are clipped at the bottom. This is for a custom titlebar and I have set the android:windowTitleSize to match 64dip in the theme.
Is there some sort of hidden padding on the titlebar? And if so, what's it size?
After testing it the old fashion way I figured out that the "unknown" padding is 8dip all around. If this is a fixed value I don't know. It match perfectly to my 48dip ImageView so with a margin of 0dip it is centered. The second ImageView need a margin of 8dip to be centered top-bottom.
Custom titlebar documentation is very rare so this is as far as I get now.
EDIT:
The background image I created for the titlebar is a 9 patch image with a content area. This is the "unknown" padding. So to sum it up - a custom titlebar does not have a hidden padding, but if one uses a 9 patch background image with a content area, the padding would be what's outside that content area. Basically everything is as it shuld be using a 9 patch image as a background...