我想在列表行中设置图像资源的背景图像,但是下面的代码对背景没有影响,它根本不影响背景。
@Override
public void bindView(View view, Context context, Cursor cursor) {
TextView mobileNo=(TextView)view.findViewById(R.id.text1);
mobileNo.setText(cursor.getString(cursor.getColumnIndex(NotesDbAdapter.KEY_TITLE)));
TextView frequency=(TextView)view.findViewById(R.id.date);
frequency.setText(cursor.getString(cursor.getColumnIndex(NotesDbAdapter.KEY_COLOR)));
String color = (cursor.getString(cursor.getColumnIndex(NotesDbAdapter.KEY_COLOR)));
ImageView background=(ImageView)view.findViewById(R.id.album_image);
if (color == "#57a2f6"){
background.setImageResource(R.drawable.bluebg);
}
else if (color == "#00cdb1"){
background.setImageResource(R.drawable.redbg);
}