Android的 - 通过复选框高度调节按钮高度? [英] Android - Adjust button height by checkbox height?
本文介绍了Android的 - 通过复选框高度调节按钮高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个的ListView
,一行其中包含按钮
,复选框
和多行的TextView
。该XML布局:
I've got a ListView
, one row of which contains Button
, CheckBox
and multiline TextView
. The xml layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerVertical="true">
<Button android:id="@+id/open"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="@drawable/play"
android:text="Play"
android:layout_centerVertical="true"
/>
<CheckBox android:id="@+id/check"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/open"
/>
<TextView android:text="@+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/label"
android:textSize="16px"
android:layout_toRightOf="@id/check"
android:paddingLeft="4px"
/>
</RelativeLayout>
的ListView
的截图:
如何调节按钮高度与复选框高度?
How can I adjust the button height with checkbox height?
推荐答案
检查出相对布局的ALIGN_TOP和ALIGN_BOTTOM属性。你可以对齐的按钮的顶部和底部的复选框的顶部和底部。
Check out the ALIGN_TOP and ALIGN_BOTTOM properties of relative layout. You can align the top and bottom of your button to the top and bottom of the check box.
这篇关于Android的 - 通过复选框高度调节按钮高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文