How to add margin to aligned component in Android
android, android-layout, margin
Solution
Margin doesn't work with Align. You can use left padding instead.
A bit offtopic, but I wouldn't recommend using odd numbers for margins/paddings in dp - the reason is that, for example, 3dp scaled for hdpi would be 4.5 pixels and that would be a problem in some cases.
Problem
I use a RelativeLayout with some widgets on it. I have a RadioGroup and a TextView and I'd like the textview to be aligned to the radiogroup AND add a margin to it to make it slightly inner than the radiogroup. Here is my code: ``` <RadioGroup android:id="@+id/radiogroupSync" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/labelTitle" android:layout_marginLeft="10dp"> <RadioButton android:id="@+id/radioFull" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/lblFull" /> <RadioButton android:id="@+id/radioPart" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/lblPart" /> </RadioGroup> <TextView android:id="@+id/lblData" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@id/radiogroupSync" android:layout_below="@+id/radiogroupSync" android:layout_margin="3dp" android:singleLine="true" android:text="2010.01.01." android:textSize="16sp" android:textStyle="bold" android:layout_marginLeft="100dp" /> ``` Obviously the TextView isn't margined by 100dp, even if I remove the alignLeft. How can I set margin for it?