我不完全得到我的列表視圖項目的佈局並不像我想要的那樣。 我希望somone會給我一些提示,因爲我現在不能使它工作一段時間。 我要的是如下:Android自定義ListViewItem佈局
這裏是我的方法:
<?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="20dip"
android:padding="6dip">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="3dip">
<TextView
android:id="@+id/nametext"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="7dip">
<ImageView
android:id="@+id/photo"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginRight="6dip"
android:src="@drawable/icon" />
<LinearLayout
android:orientation="vertical"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="fill_parent">
<TextView
android:id="@+id/toptext"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:gravity="center_vertical"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:id="@+id/middletext"
android:singleLine="true"
android:ellipsize="marquee"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:id="@+id/bottomtext"
android:singleLine="true"
android:ellipsize="marquee"
/>
</LinearLayout>
<ImageView
android:id="@+id/stars"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="6dip"
android:src="@drawable/icon" />
</LinearLayout>
任何幫助,將不勝感激。 我已經嘗試了不同的尺寸和RelativeLayout。不用找了。 它看起來不像我認爲它應該。
編輯3個空白失蹤
EDIT2加入PIC
對不起。整個XML代碼在文本中,但它不會顯示。請任何人都可以編輯,改變這一點,我不知道如何。看到完整的xml使用編輯模式。對造成的不便表示歉意。 – GuyFawkes 2011-04-01 15:05:48