I have following XML layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@layout/light_list_item_border"
android:orientation="vertical" >
<Button
android:id="@+id/light_list_item_lightdim_button"
android:layout_width="75dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="@drawable/button_on"
android:text="@string/button_on"
android:textColor="@color/white"
android:layout_margin="5dp"
/>
<TextView
android:id="@+id/light_list_item_lightrgb_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/light_list_item_lightdim_button"
android:layout_alignBottom="@+id/light_list_item_lightdim_button"
android:layout_alignParentLeft="true"
android:text="@+id/label"
android:layout_marginLeft="5dp"
android:textColor="@color/white"
android:textSize="15sp" />
<TextView
android:id="@+id/light_list_item_lightrgb_labelSzene"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/light_list_item_lightdim_button"
android:layout_marginLeft="5dp"
android:text="@+id/label"
android:textColor="@color/white"
android:textSize="15sp" />
<Button
android:id="@+id/Button01"
android:layout_width="75dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_below="@+id/light_list_item_lightdim_button"
android:layout_marginBottom="5dp"
android:layout_marginRight="5dp"
android:background="@drawable/button_on"
android:text="@string/button_add"
android:textColor="@color/white" />
</RelativeLayout>
but for any case:
android:layout_marginBottom="5dp"
of the 2nd button is 'ignored'?
Here you can see my Problem: the buttons labeled with a "+" should have a margin of 5 to the bottom border.
I have tried android:paddingBottom
as well, but doesn't succeeded
Thanks
I think we need to see your "@layout/light_list_item_border" to be able to solve this. But for this problem, wouldnt it be easier to put padding on the relative layout itself, and skip all the margins?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@layout/light_list_item_border"
android:padding="5dp">
If you want some space between layout and its content try providing a padding property to the relative layout itself say 5dp and remove unnecessary margin properties.
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