변수에 따라 ListView 항목의 색상을 변경하고 싶습니다. (Async 클래스로 채워짐). 그래서 이걸 가지고 있어요android ListView item fore 색
public class Search extends AsyncTask<Void, String, Void> {
boolean blue = false;
@Override
protected Void doInBackground(Void... params) {
Resources res = getResources();
List<String> Items = Arrays.asList(res.getStringArray(R.array.Items));
for (String it : Items) {
if (it.contains("blue")) { blue = true; } else { blue = false; }
publishProgress(it);
}
return null;
}
@SuppressWarnings("unchecked")
@Override
protected void onProgressUpdate(String... item) {
((ArrayAdapter<String>)getListAdapter()).add(item[0]);
// Change the color of the current item depending on "blue"
}
}
이게 가능합니까? 감사!
클래스 내부 또는 어디에? – ali
BaseAdapter 또는 일부 다른 어댑터를 확장하십시오. –