Android listview中嵌套Checkbox的布局文件
效果图如下:
需要注意的地方:
1、设置比例 只是设置中间部分的比例
2、android:id="@+id/name"显示的是文件名称,比如像第二个长度太长,于是设置宽度为android:layout_height="20dip",这样多出来的字就不显示了
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="80dip"
android:orientation="horizontal" android:layout_weight="1">
<ImageView android:id="@+id/icon" android:layout_width="wrap_content"
android:layout_height="fill_parent" ></ImageView>
<RelativeLayout android:layout_width="wrap_content"
android:layout_height="40dip" android:layout_weight="1">
<TextView android:id="@+id/nameLab" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="程序名称 : "></TextView>
<TextView android:id="@+id/name" android:layout_width="wrap_content"
android:layout_toRightOf="@id/nameLab" android:layout_height="20dip"
android:layout_marginLeft="3dip" android:textColor="#FFD700"></TextView>
<TextView android:id="@+id/timeLab" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_below="@id/name"
android:text="安装时间:"></TextView>
<TextView android:id="@+id/time" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_below="@id/name"
android:layout_alignLeft="@id/name" android:textColor="#FFD700"></TextView>
</RelativeLayout>
<RelativeLayout android:layout_width="wrap_content"
android:layout_height="40dip" >
<CheckBox
android:id="@+id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="false"
android:focusableInTouchMode="false"/>
</RelativeLayout>
</LinearLayout>