我的應用程序顯示一個項目列表,每一行是一個項目標題,形象的旁白,該行保留的文字空間70%,而圖像的30%。想象一下iPhone應用程序商店的外觀。爲此推薦哪個視圖/佈局組合?android:我應該使用哪個視圖來顯示文本和圖像?
我用Google搜索,發現這篇文章:
http://www.curious-creature.org/2009/02/22/android-layout-tricks-1/
請問這個觀點聽起來好?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:padding="6dip">
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="6dip"
android:src="@drawable/icon" />
<TextView
android:id="@+id/secondLine"
android:layout_width="fill_parent"
android:layout_height="26dip"
android:layout_toRightOf="@id/icon"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:singleLine="true"
android:ellipsize="marquee"
android:text="Simple application that shows how to use RelativeLayout" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/icon"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_above="@id/secondLine"
android:layout_alignWithParentIfMissing="true"
android:gravity="center_vertical"
android:text="My Application" />
感謝我編輯原來的職位。你可以看一下嗎? – Yang 2010-03-30 20:31:10
這就是我在我所鏈接的兩個問題中討論的帖子。 (好的,我在Android官方博客上將其鏈接到它,而不是他個人的博客)。但是,我們中的一些人試圖讓它工作,並沒有設法這樣做。它看起來很棒,直到你把它放在一個ListView中,然後出於一些無法解釋的原因,它不能正確加載。如果你能讓它看起來不錯,讓我們知道! – 2010-03-30 20:41:04
我已經列入了新的錯誤,你可以看看我的新帖子:http://stackoverflow.com/questions/2549585/android-failed-to-setcontentview-when-switching-to-listactivity – Yang 2010-03-31 01:06:12