设置ImageView的src:
image.setImageDrawable(getResources().getDrawable(R.drawable.blackk));
String path=Environment.getExternalStorageDirectory()+File.separator+”test.jpg”;
Bitmap bm = BitmapFactory.decodeFile(path);
image.setImageBitmap(bm);
image.setImageResource(R.drawable.blackk);
设置ImageView的background:
image.setBackground(getResources().getDrawable(R.drawable.blackk));
image.setBackgroundResource(R.drawable.blackk);
image.setBackgroundDrawable(getResources().getDrawable(R.drawable.blackk));