In some case you have lots of attributs or you just missed that you included earlier :
android:layout_margin="xdp"
You can't use it with specific layout margination
I had a <View> inside a <RelativeLayout> and the marginBottom on that view did not work. I found out that my chain of layout_below was broken, so therefore it makes sense that the layout did not know from which view the margin should be calculated.
If you chain it properly using layout_below or the other positioning tools, you do not need to worry about wrap_content or match_parent like others are suggesting. Example:
<?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="wrap_content">
<View
android:id="@+id/separator"
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginBottom="11dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/separator">
...
Maybe you can set android:paddingBottom="" of <RelativeLayout> to get the same effect.
It is realy just a bug of the <RelativeLayout>, so you could try to wrap the RelativeLayout inside of a <LinearLayout> and set the margin there.
Make sure the layout_height of your root container is set to match_parent instead of wrap_content.
It works if you use android:layout_marginBottom with android:layout_alignParentBottom="true".
For example :
android:layout_alignParentBottom="true"
android:layout_marginBottom="50dp">