嗨,我相当了解编程,但这里的问题是我正在解析来自 json 的数据。因此,我的目标是根据以下条件设置每一行的背景颜色:
Dog 或 Cat 或 Elephant 或 Rhino 或 Lion 它们各自的列表视图背景颜色应为蓝色、红色、黄色、绿色
{
"pets" : {
"dog_id" : 1,
"dog_name" : "Dave",
"cat_id" : 2,
"cat_name" : "Prudie"
"elephant_id" : 3,
"elephant_name" : "Poncho",
"lion_id ": 4
"lion_name" : "King"
}
}
请帮忙,我可以解析这个 JSON,但我希望 listView 显示不同的颜色。到目前为止,我可以更改 listView 的整个背景,每个项目的文本,但未能有条件地执行行颜色。