I'm trying to set screen margins following the guidelines for Layout - Metrics and keylines. Specifically, list content on mobile screens should have a margin of 72 dp and align with the title as shown in the guide:
As Android Studio automatically generates margin values in the res/dimens.xml, I thought that I'd get my content to align with the title by adding my own 'inner' margin:
dimens.xml
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<!-- 16 + 56 = 72 = "Content left margin from screen edge" -->
<dimen name="content_horizontal_margin">56dp</dimen>
</resources>
myactivity.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin">
<TextView
android:id="@+id/tvEditPlaylistInfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="@dimen/content_horizontal_margin"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="test" />
<ImageButton
android:layout_width="36dp"
android:layout_height="36dp"
android:src="@drawable/action_current"
android:layout_alignBottom="@id/tvEditPlaylistInfo"
android:layout_toRightOf="@id/tvEditPlaylistInfo"
android:layout_marginLeft="16dp"/>
<ListView
android:id="@+id/lvAudioFiles"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/content_horizontal_margin"
android:layout_below="@id/tvEditPlaylistInfo">
</ListView>
</RelativeLayout>
But somehow my content is "off" by about 8dp (emulator, Lollipop 22).
I'm using a custom theme with parent Theme.AppCompat.Light.DarkActionBar
but I only changed colors so I think that is not the source of my problem.
What am I missing?