Je crée une liste de sujets ajoutés dans mon emploi du temps et comment puis-je changer la couleur de fond de l'élément de la liste en rouge si le statut du sujet est égal à fermé.Changer la couleur de fond 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);
}
Avez-vous un ArrayAdapter? Pls jeter un oeil à ces tutoriels http://www.vogella.com/articles/AndroidListView/article.html –
oui. mais je veux juste savoir comment puis-je changer la couleur d'arrière-plan de listitem si le statut du sujet est égal à fermer sans sélectionner – user2692273
voir ma réponse, je ne sais pas quel est votre problème –