我想要一個複雜的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的左邊距與複選框的寬度相同,它不會超過複選框。這個問題的問題是,文本不應該通過複選框。 –