Android: Gallery的adapter中getView方法被執行多次
項目中遇到一個奇怪的問題:為Gallery設置的adapter中的getView方法被調用多次
客戶需求:一次隻能滑動一格
參考資料:
https://stackoverflow.com/questions/4687370/gallery-scroll-one-image-at-a-time
https://stackoverflow.com/questions/6058609/android-gallerys-getview-returning-incorrect-position
Android Adapter multiple getView
https://stackoverflow.com/questions/3196219/android-adapter-multiple-getview
android listview中getView重複被調用的問題
<RelativeLayout xmlns:android="https://schemas.android.com/apk/res/android" android:id="@+id/RelativeLayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="@drawable/repeat_bg">
<ListView
android:id="@+id/friend_list" android:layout_width="fill_parent" android:layout_height="fill_parent"
android:layout_weight="1" android:cacheColorHint="#00000000" android:divider="#CCCCCC" android:fastScrollEnabled="true" android:focusableInTouchMode="true" />
</RelativeLayout>
<LinearLayout xmlns:android="https://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#f3f3f3" android:orientation="vertical" > <ListView android:id="@+id/requestObjLV" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" android:cacheColorHint="#00000000" android:divider="#CCCCCC" /> </LinearLayout>
當ListView\GridView設置固定大小,就不會多次調用了~
最後更新:2017-04-04 07:03:25