Android, Imageview Stretch
I'm trying to get my imageview with a drawable png to fill the display (I don't care about ratios). However, fill_parent doesn't work, and as far as I know there are no background
Solution 1:
I used to stretch/shring ImageView programmatically, probably this piece of code will help you:
ImageView imageView=newImageView(context);
imageView.setAdjustViewBounds(true);
imageView.setImageBitmap(bitmap);
imageView.setMaxHeight(maxHeight);
imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
layout.addView(imageView);
Solution 2:
All View types have android:background
, including RelativeLayout
. No need for an ImageView
, although I can't see any reason for your one to not fill the parent.
Post a Comment for "Android, Imageview Stretch"