我正在構建Twitter類型的客戶端。這裏是我的ListView行看起來像如何讓我的ListView行看起來像Twitter應用[Screenshot]?
我希望它看起來更像是:
我怎樣才能讓我的填充和形象的定位是否正確?下面是我的XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/RelativeLayout01" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:id="@+id/avatarImageView">
</ImageView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/usernameTextView"
android:textStyle="bold"
android:layout_toRightOf="@+id/avatarImageView"
android:layout_alignParentTop="true" android:textColor="#636363">
</TextView>
<TextView
android:id="@+id/bodyTextView"
android:layout_below="@+id/usernameTextView"
android:layout_toRightOf="@+id/avatarImageView"
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:textColor="#636363">
</TextView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/usernameTextView"
android:id="@+id/dateTextView"
android:text="date" android:textColor="#636363">
</TextView>
</RelativeLayout>
我複製了你的佈局文件,並填充了一些虛擬數據,沒有任何問題。你是如何測試你的應用程序的?順便說一句......即使我自己沒有找到答案,我也不會推薦使用其他答案所暗示的那麼多'LinearLayouts'。 [Here](http://www.curious-creature.org/2009/02/22/android-layout-tricks-1/)是Google的Android開發人員之一Romain Guy的解釋...編輯:也許你可以將適配器的代碼發佈到ListView中,這樣可以更容易測試它......懶得自己做; – taymless 2011-05-23 14:27:02