我有一个代码,如果在数据库上找不到图像,则会分配一个默认图像,我该如何不分配任何东西,谢谢:
buttonSignIn = Button(root, text="Sign in", width=10, bg='black', fg='white', command=new_winF).place(
x=30, y=130)
答案 0 :(得分:2)
设置为
contactProfile.setBackgroundResource(0);
答案 1 :(得分:1)
设置为
case R.id.child2 :
ImageView contactProfile = (ImageView) view;
byte[] imageBytes = cursor.getBlob(cursor.getColumnIndex(Database.DATABASE_CHILD_2));
if(imageBytes != null ){
// Pic image from database
contactProfile.setImageBitmap(BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.length));
}else {
// If image not found in database , assign a default image
contactProfile.setBackgroundResource(0);
}
break;
}