1
我想在列表行中設置圖像資源的背景圖像,下面的代碼如何對背景沒有影響,它根本不影響背景。ImageView背景行
@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);
}
非常感謝快速回復,它的作品! –
@GibranGul歡迎:) –