可能性の重複:
Android: Scale a Drawable or background image?フルスクリーン/スケーリングされた画像
私はImageViewのが含まれているポップアップをしたいのですが。今、私が描いているDrawableは100x200pxです。 Drawableは質の良いものなので、フルスクリーンで表示したいと思います。私はどのように考えている。これは、これまでの私のコードです:
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);
私はすでにFILL_PARENTにImageViewのLayoutParamsのWRAP_CONTENTを設定しようとしましたが、これは状況は変わりません。
任意の助けをいただければ幸いです。.. Drawableの幅が100、高さは200 IがDrawableのかImageViewのスケーリングを考えるが、これは、これまで成し遂げることができなかったよです!
これは[重複する質問](http://stackoverflow.com/q/1400782/403455)のようです。 –
ありがとうございました.Googleで検索した後にこれを見つけられませんでした。幅は今伸ばされていますが、高さは依然として元の大きさです。なぜでしょうか? – harmjanr