我在右側的每個ListView項目中放置了一個圖像,在佈局xml中,我將它的寬度和長度設置爲20dip,類型很小,我發現很難點擊它,導致圖像只佔用20 * 20浸,我希望它的長度不變,而其高度完全填充父, 我想:如何使圖像更容易點擊?
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>
如果你仔細觀看爲Android的Twitter客戶端,你會發現,在每個ListView項的右側的圖像是相當容易點擊(即使你有沒有點擊圖片,但是例如在按鈕上方說)。我想知道如何做到這一點。
twitter image http://www.freeimagehosting.net/uploads/889d10c435.png
任何一個?任何幫助?
不,實際上我直接利用來自Twitter的圖像(我解壓的APK,並獲得圖像),它是完全一樣的大,因爲它看起來,我不知道他們是否已經使ImageView的長度充滿了父項,所以【ImageView】比它裏面的【image】更大,通過我嘗試過但仍然不知道該怎麼做。 – DiveInto 2010-08-13 06:29:37