I have a drawable that I would like to render in different sizes on the fly, as opposed to setting the size in layout file. How might I do that? I am referring to the call
imageView.setImageResource(R.drawable.image);
I have a drawable that I would like to render in different sizes on the fly, as opposed to setting the size in layout file. How might I do that? I am referring to the call
imageView.setImageResource(R.drawable.image);
Decode the resource as a bitmap with a resolution (and other options) specified, then tell the ImageView to show the bitmap:
BitmapFactory.Options options = new BitmapFactory.Options();
options.outHeight = XXXX;
options.outWidth = XXXX;
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.id.myimage, options);
imageView.setImageBitmap(bm);