我想要一个复杂的ListView,在左侧有一个标题和说明,在右侧有一个复选框。我正在这样做,但是左侧的文本正在通过右侧的复选框。左边有2个TextView和右边的CheckBox的Android布局在复选框上有文本
我该如何预防?
我的布局代码目前的样子:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:paddingTop="10dip"
android:paddingBottom="10dip"
android:paddingLeft="15dip">
<CheckBox
android:id="@+id/list_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:checked="false"
/>
<TextView
android:text="Some Title"
android:id="@+id/list_complex_title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/list_checkbox"
android:textAppearance="?android:attr/textAppearanceLarge"
/>
<TextView
android:text="Some long description Some long description Some long description Some long description Some long description."
android:id="@+id/list_complex_caption"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#98AFC7"
android:layout_below="@+id/list_complex_title"
android:textAppearance="?android:attr/textAppearanceSmall"
/>
</RelativeLayout>
可惜我是新来的网站,需要更多的积分后的图像:(
如果可能的话,我想垂直居中复选框为好。
任何布局专家?
感谢您的提示! – user914453
如果你设置左边距到TextView如何解决这个问题?它会保留空间左侧,但它不会解决这个问题.TextView包装在复选框右侧 – Dharmendra
@Dhrmendra:如果你给TextView的左边距与复选框的宽度相同,它不会超过复选框。这个问题的问题是,文本不应该通过复选框。 –