Android布局,左侧有两个文本视图,右侧有复选框,文本覆盖复选框
我正在尝试创建一个复杂的ListView,它的左侧有一个标题和描述,右侧有一个复选框。我正在这样做,但是左边的文本在右边的复选框上 我怎样才能防止呢 我的布局代码当前看起来像:Android布局,左侧有两个文本视图,右侧有复选框,文本覆盖复选框,android,layout,Android,Layout,我正在尝试创建一个复杂的ListView,它的左侧有一个标题和描述,右侧有一个复选框。我正在这样做,但是左边的文本在右边的复选框上 我怎样才能防止呢 我的布局代码当前看起来像: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="fill_parent" android:layout_width="fill_parent" android:padd
<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"
在您的描述文本视图中,使其不会转到复选框,无需执行更多操作。
根据您的布局代码,只需在复选框上方的文本视图上留出空白即可。
它会解决你的问题。
我已经做了。非常感谢!有没有办法让我垂直居中该复选框?我可以使用:android:layout\u centerInParent=“true”写一行android:layout\u centerVertical=“true”将其垂直居中在复选框中,如果将“左边距”设置为“文本视图”如何解决此问题?它将在左侧保留空间,但不会解决此问题。文本视图在复选框右侧换行side@Dhrmendra:如果你给文本视图的左边距与复选框的宽度相同,它将不会在复选框上出现。这个问题问题是,文本不应该在复选框上方。问题是,左侧的文本在右侧的复选框上方。他在问题中提到。请再次检查。我认为user914453已通过我的回答解决了问题,因此现在结束。感谢您的回复。