2

撮影後に写真を表示するアプリを作ろうとしています。問題は、画面に対して同じアスペクト比のビットマップを拡大縮小できないように見えることです。

imageView.setScaleType(ScaleType.FIT_XY);を試しました。しかし、それは比率を維持しません。また、Android:Scaleもありません。

私に何ができる?

4

1 に答える 1

1

あなたが試すことができます

Bitmap.createScaledBitmap (Bitmap src, int dstWidth, int dstHeight, boolean filter)

これがスニペットです!これがあなたのお役に立てば幸いです

 public static Bitmap createScaledBitmap(String path, float scale, boolean filtering){
    Bitmap src = BitmapFactory.decodeFile(path);
    int width = (int)( src.getWidth() * scale + 0.5f);
    int height = (int)( src.getHeight() * scale + 0.5f);
    return Bitmap.createScaledBitmap(src, width, height, filtering);
  }

ドキュメントも参照してください。 スケーリングされたビットマップを作成します

于 2012-11-17T06:25:27.480 に答える