1
我已經實施了一個刷卡刷新我的片段之一。問題是刷新圖標不斷旋轉,並且不刷新列表。我已經實現了onRefresh()
致電notifyDataSetChanged()
,但這似乎並沒有刷新列表Android刷卡刷新動畫保持旋轉
填充列表&刷卡視圖
swipe = (SwipeRefreshLayout) rootView.findViewById(R.id.swipe);
swipe.setOnRefreshListener(this);
cursor = db.getAllItems();
String[] values = new String[cursor.getCount()];
cursor.moveToFirst();
for(int i = 0; i < cursor.getCount(); i++)
{
String row = cursor.getString(cursor.getColumnIndex("name"));
values[i] = row;
cursor.moveToNext();
}
final String[] columns = new String[] {db.KEY_ITEM_NAME, db.KEY_MEASUREMENT, db.KEY_UNIT};
int[] to = new int[] {R.id.ingredientName, R.id.ingredientMeasurement, R.id.ingredientUnit};
adapter = new ShoppingCustomAdapter(getActivity(), R.layout.shopping_list_row, cursor, columns, to);
setListAdapter(adapter);
onRefresh
@Override
public void onRefresh() {
adapter.notifyDataSetChanged();
}
謝謝+1 – JJSmith