❶ 如何動態修改ListVIew中每個Item的值
給你一個源代碼參考一下,希望能幫到你,謝謝
public void UpdateList(int selectedItem)
{
ListAdapter la = m_List.getAdapter();
int itemNum = m_List.getCount();
for(int i=0; i<itemNum; i++)
{
HashMap<String, Object> map = (HashMap<String, Object>)la.getItem(i);
if ( i == selectedItem)
map.put("ItemIcon", R.drawable.image1);
else
map.put("ItemIcon", R.drawable.image2);
}
((SimpleAdapter)la).notifyDataSetChanged();
}