3
我使用了一个带有一些小部件的RelativeLayout。我有一个RadioGroup和一个TextView,我希望textview与radiogroup对齐,并为它添加一个边距,使它比radiogroup略微内在。如何在Android中为对齐组件添加边距
这里是我的代码:
<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"
/>
显然TextView的不100dp保证金,即使我删除alignLeft。我如何设定保证金?
是否有意忽略边距?我不使用奇数,我总是使用偶数(请参阅100dp或16 sp)请求澄清或建议改进。 – Nestor
填充左边将做诡计 – kvh
我在这里指的是 : android:layout_margin =“3dp” 我不确定它是否有意为之,但我猜对齐的实现设置了相同的值边际设置,只有更高的优先级。 –
npace