Bonjour,
Lorsque j'utilisais un SimpleCursorAdapter j'utilisais la fonction
Qui me permettait de personnaliser chaque fond de mes objets dans la listview en fonction d'un paramètre de la table.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 adapter.setViewBinder(new SimpleCursorAdapter.ViewBinder() { public boolean setViewValue(View view, Cursor cursor, int columnIndex){ if (view.getId() == R.id.OptionColor) { final String colorIR = cursor.getString(cursor.getColumnIndex("is_read")); final String colorIO = cursor.getString(cursor.getColumnIndex("is_ok")); if(colorIR.equals("null") && colorIO.equals("null")) { ((View) view.getParent()).setBackgroundColor(android.graphics.Color.WHITE); } else if(!(colorIR.equals("null")) && colorIO.equals("null")) { ((View) view.getParent()).setBackgroundColor(android.graphics.Color.parseColor("#F99DA6")); } else if(!(colorIR.equals("null")) && !(colorIO.equals("null"))) { ((View) view.getParent()).setBackgroundColor(android.graphics.Color.parseColor("#A4F7A4")); } return true; } return false; } });
Pour des besoins de personnalisation je suis repasser a un simpleAdapter, y a t-il une méthode équivalente ?
Partager