我在我的時間表中創建了添加主題的列表,如果主題狀態等於關閉,我如何將列表項的背景顏色更改爲紅色。更改Listitem背景顏色
for (DataTimetable cn : timetable) {
String section = cn.getSection();
String subjects = cn.getSubject();
String day = cn.getDay();
String timein = cn.getTimeIn();
String timeout = cn.getTimeOut();
String room = cn.getRoom();
String units = cn.getUnits();
String status = cn.getStatus();
total = total + Double.parseDouble(units);
String time = timein + " - " + timeout;
// creating new HashMap
HashMap<String, String> map = new HashMap<String, String>();
// adding each child node to HashMap key => value
map.put(TAG_SECTION, section);
map.put(TAG_SUBJECT, subjects);
map.put(TAG_DAY, day);
map.put(TAG_TIME, time);
map.put(TAG_ROOM, room);
map.put(TAG_UNITS, units);
map.put(TAG_STATUS, status);
// adding HashList to ArrayList
TimetableList.add(map);
}
你有一個ArrayAdapter?請看看這些教程http://www.vogella.com/articles/AndroidListView/article.html –
是的。但我只想知道,如何改變listitem的背景顏色,如果主題狀態等於關閉沒有選擇 – user2692273
看到我的答案,我做網獲取你的問題是 –