I have an Inner relative layout with 2 images, and when I set the android:layout_marginRight attribute it doesn't do anything.
Here is my code:
<RelativeLayout
android:id="@+id/location_image_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="80dp" />
<ImageView
android:layout_width="69.33dp"
android:layout_height="72dp"
android:background="@drawable/icon"
android:layout_centerInParent="true" />
</RelativeLayout>
The problem is in the layout's property android:layout_width
. When it is set to "wrap_content"
,the android:layout_marginRight
won't working, but rather, only when it is set to "fill_parent"
, the android:layout_marginRight
will work.
You have used the following thats why it is happening
android:layout_alignParentRight="true"
just remove this line you will get the margin from the right in your imageview..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With