Android布局与2 TextViews在左边和CheckBox在右边有文本超过复选框



我试图有一个复杂的ListView,左边有一个标题和描述,右边有一个复选框。我正在这样做,但是左边的文本会越过右边的复选框。

我该如何预防呢?

我的布局代码目前看起来像:

<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>

不幸的是,我是新来的网站,需要更多的点来发布图像:(

如果可能的话,我想把复选框垂直居中。

有布局专家吗?

写语句

android:layout_toLeftOf="@+id/list_checkbox"

在你的描述textview中这样它就不会跳转到复选框

没什么可做的了。根据你的布局代码,只是给左边距的TextView,这是在复选框。它会解决你的问题。

最新更新