What I'm trying to accomplish is simply to create a small 2-4dp padding border around my imageview. The result (looks correct in ADT but this is what it looks like on a device):
Notice that there is 5 px in top and 7 px space left/right/bottom (this is for hdpi device)
This is my xml for the row:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="2dp">
<RelativeLayout
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@android:color/white"
android:layout_alignParentRight="true"
android:layout_centerVertical="true">
<ImageView
android:src="@android:color/black"
android:id="@+id/row_image"
android:scaleType="centerCrop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:layout_centerInParent="true"/>
</RelativeLayout>
</RelativeLayout>
I've tryed everything: Adjustviewbounds, centerCrop, wrap_content, match_parent, center, centerInside, height=46/width=46, . Any new suggestions will be greatly appreciated, layout_gravity=center.
Edit new info: So I tryed removing android:layout_alignParentRight="true" and android:layout_centerVertical="true" and now the padding/margin looks correct BUT its not placed to the right side.