1. 程式人生 > >android之ImageView

android之ImageView

三種設定圖片源的方法
ImageView iv;

String fileName = "/data/data/com.test/aa.png;
Bitmap bm = BitmapFactory.decodeFile(fileName);
iv.setImageBitmap(bm);


ImageView iv = new ImageView(context);
iv.setImageResource(iv[position]);
iv.setScaleType(ImageView.ScaleType.FIT_XY);
iv.setLayoutParams(new Gallery.LayoutParams(136,88));


mImageView = (ImageView)this.findViewById(R.id.myImageView1);
mImageView.setImageDrawable(getResources().getDrawable(R.drawable.right));