即時通訊嘗試創建一個ListView充滿從API獲取的項目,並根據變量,我想顯示/隱藏該行的ListView項目佈局中的TextView。Android:我如何根據Array值動態顯示/隱藏ListView項目中的元素?
我的ListView項目佈局包含3個TextViews。使用android:visibilty:「GONE」隱藏默認值。
我使用的是爲我的ListAdapter:
ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();
附加到:
ListAdapter adapter = new SimpleAdapter(this, mylist , R.layout.main,
new String[] { "title", "info","comments", "score" },
new int[] { R.id.item_title, R.id.item_subtitle, R.id.post_comments, R.id.post_score });
setListAdapter(adapter);
final ListView lv = getListView();
所以我的問題是,我怎麼可以遍歷整個列表,以檢查是否 「variableA的」= =「something」然後在該單個項目中顯示隱藏的TextView?
或者有沒有辦法動態地插入一個TextView的單個ListView項目?
謝謝!