我在右侧的每个 ListView 项中放置了一个图像,在布局 xml 中,我将其宽度和长度设置为 20dip ,有点小,我发现很难点击它,因为图像只占用 20*20 dip ,我希望它的长度不会改变,而它的高度完全填满了父母,我试过了:
android:layout_width="20dip"
android:layout_height="fill_parent"
但它不起作用。
下面是我的xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/item"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="6dip"
android:background="#FFFFFF">
<ImageView android:id="@+id/avatar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="6dip"
android:src="@drawable/default_happy_face" />
<RelativeLayout
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_toRightOf="@id/avatar"
android:layout_toLeftOf="@+id/optionImg">
<!-- some stuff unrelated-->
</RelativeLayout>
<!-- v Pay attention here v -->
<ImageView android:id="@+id/optionImg"
android:layout_width="20dip"
android:layout_height="fill_parent"
android:layout_marginLeft="15dip"
android:paddingLeft="5dip"
android:adjustViewBounds="true"
android:background="@drawable/option_normal"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"/>
</RelativeLayout>
如果你仔细观察了安卓的twitter客户端,你会发现每个ListView Item右侧的图片都非常容易点击(即使你没有点击图片,例如在按钮顶部)。我想知道该怎么做。
推特图片 http://www.freeimagehosting.net/uploads/889d10c435.png
任何人?有什么帮助吗?