0
我想通過java代碼更改我的Activity
s ListView
中的TextView
的顏色。 ListView
包含由MatrixCursor
和ArrayAdapter
供給的多行。 TextView
的顏色應該是綠色或白色,應由if
條款決定。我怎樣才能做到這一點?更改TextView的顏色
citem = NameManager.getciList();
NameManager.WriteName(citem);
MatrixCursor cursor;
cursor = NameManager.getnameList();
startManagingCursor(cursor);
if (cursor.getString(9).equals("yes")){
//TODO set color of R.id.name color here
}
String[] from = { "name", "info", "status", "path", "folder", BaseColumns._ID };
int[] to = { R.id.name, R.id.info, R.id.status, R.id.path };
final SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
R.layout.row, cursor, from, to);
setListAdapter(adapter);