我遇到列表視圖及其項目的問題。當向上/向下滾動列表視圖時,我注意到項目稍微調整大小(大約一個像素),在我的應用程序中,它看起來像^。兩個項目之間的分隔線應該是一個像素高(使用默認的Android行爲),但當滾動分隔線有時是2像素或0像素(不可見)。這是不好的,因爲它看起來像兩個項目形成一個列表項目。Android列表視圖:滾動以奇怪的方式調整項目大小
有沒有人在滾動ListView時出現這個奇怪的調整大小問題的解決方案?
我的開發設備是帶有固件版本2.1-update1的HTC Wildfire。模擬器設置爲:Android 2.1-update1,外觀WVGA800和hw.lcd.density = 240。
ListView控件充滿以下項目佈局和我使用默認設置爲ListView:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:background="#F0F0F0">
<ImageView
android:id="@+id/test_icon"
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:src="@drawable/icon"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:scaleType="centerInside">
</ImageView>
<TextView
android:id="@+id/testTextView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_alignWithParentIfMissing="true"
android:layout_toLeftOf="@+id/test_icon"
android:text="test"
android:textColor="#555555" />
</RelativeLayout>
謝謝!
這是否發生在仿真器和真實設備上? – Blundell 2011-03-24 11:06:39
是的,它發生在我的模擬器和設備上 – Delblanco 2011-03-24 12:52:37