listview常見問題整理

listview滾動時 會出現陰影 效果很差 解決辦法 android:cacheColorHint="#00000000"
 listview 在使用notifydatachanged 時會出現 The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. 
解決方法:將數據源改變 放到UI線程中
listview  滾動時 出現 不靈敏的問題:
使用緩存佈局
if (convertView == null) {
convertView = mInflater
.nflate(R.layout.contacts_lv_item, null);
holder = new ViewHolder();
holder.tv_name = (TextView) convertView
.findViewById(R.id.tv_name);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}

public final class ViewHolder {
public TextView tv_name;// 姓名

}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章