Possible Duplicate:
Android: Scale a Drawable or background image?
I'd like to make a popup that contains an ImageView. Right now, the Drawable that I'm showing is 100x200px big. The Drawable is of good quality, so I would like to show the image fullscreen. I have no idea how though. This is my code so far:
AlertDialog.Builder imgDialog = new AlertDialog.Builder(
myactivity.this);
ImageView imageView = new ImageView(myactivity.this);
Matrix matrix = new Matrix();
matrix.postScale(2, 2);
imageView.setImageDrawable(myDrawable);
imageView.setImageMatrix(matrix);
LayoutParams imageViewLayoutParams = new LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
imageView.setLayoutParams(imageViewLayoutParams);
LinearLayout layout = new LinearLayout(myactivity.this);
layout.setOrientation(LinearLayout.VERTICAL);
layout.addView(imageView);
imgDialog.setView(layout);
I already tried to set the WRAP_CONTENT of the ImageView LayoutParams on FILL_PARENT, but this doesn't change the situation. The Drawable width is 100, and the height is 200. I'm thinking about scaling the Drawable or the ImageView, but failed to get this done so far..
Any help would be appreciated!