I have two imageviews which has to be aligned side by side. So, I used linearlayout with horizontal orientation and having weight same for each imageview width wise. This works fine, but I need the separation between two imageviews to be visible. So, I kept android:padding but it doesn't seem to have any affect still. For the better idea on my problem, please refer the picture I pasted below.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dip"
android:paddingRight="10dip"
>
<ImageView
android:id="@+id/imageView1"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_gravity="center"
android:padding="5dp"
android:layout_weight="1"
android:scaleType="fitXY"
android:adjustViewBounds="true"
android:background="@drawable/imagebgd"
android:src="@drawable/icon" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_gravity="center"
android:scaleType="fitXY"
android:padding = "5dp"
android:layout_weight="1"
android:adjustViewBounds="true"
android:background="@drawable/imagebgd"
android:src="@drawable/icon" />
</LinearLayout>
As you can see here, there is no separation visible.
However, I do have another problem. I kept nine patch image as background(orange color)
for the imageview to have border for the imageview,
but the border's padding changes from one image to other i.e., border thickness around the imageview changes, but I want it to have stable thickness irrespective of the images. Can someone please help me on these things?
Note: I know the hacks like surrounding each imageview again by a linearlayout or Keeping an empty view between imageviews. But I just want to achieve it with preferred things. Because it works for other views when I add padding, why not for these?