我是新的Android,我有ListView
與自定義適配器,我傳遞一個字符串如果匹配ListView
項目想要更改列表項文本顏色從Activity
。如何從處理程序更改列表視圖項的文本顏色和圖像顏色
這裏我的代碼:
MyActivity:
public void handleResult(String rawResult) {
if(Utility.isNotNull(rawResult.getText().toString())) {
for(int i=0;i<listView.getAdapter().getCount();i++){
if(rawResult.equals(listItems.get(i).getStockItems())){
// listView.getChildAt(i).setBackgroundColor(ContextCompat.getColor(context, R.color.hint));
/* Here I want to change list item text color*/
adapter.notifyDataSetChanged();
}
}
}
}
提前感謝!
太謝謝你了! – appu