2017-05-13 4 views

答えて

0

あなたはたぶん...あなたは幅と高さの画面密度に画像の拡大縮小にSquareImageViewを作成することができます別のアプローチを試みるこの

public void setImageSize(byte[] imageThumbnail) 
{ 
     DisplayMetrics metrics = new DisplayMetrics(); 
     getWindowManager().getDefaultDisplay().getMetrics(metrics); 

     Bitmap bitmapOrg = new BitmapDrawable(getResources(), new ByteArrayInputStream(imageThumbnail)).getBitmap(); 

     int width = bitmapOrg.getWidth(); 
     int height = bitmapOrg.getHeight(); 

     float scaleWidth = metrics.scaledDensity/5; 

     //set image in imageView 
     imageView.setImageBitmap(bitmapOrg); 

     //set imageView dynamic width and height 
     imageView.getLayoutParam().width = scaleWidth; 
     imageView.getLayoutParam().height= scaleWidth; 

} 

それとも

のように行うことができます。

関連する問題