List of usage examples for android.graphics.drawable LayerDrawable getIntrinsicHeight
@Override public int getIntrinsicHeight()
From source file:com.fabernovel.alertevoirie.ReportDetailsActivity.java
private void setPictureToImageView(String pictureName, ImageView imageView) { Bitmap picture = null;//from ww w.jav a 2 s . c om try { InputStream in = openFileInput(pictureName); picture = BitmapFactory.decodeStream(in); in.close(); LayerDrawable d = (LayerDrawable) getResources().getDrawable(R.drawable.editable_picture_frame); if (picture.getHeight() > picture.getWidth()) { Matrix m = new Matrix(); m.postRotate(-90); picture = Bitmap.createBitmap(picture, 0, 0, picture.getWidth(), picture.getHeight(), m, true); } picture = Bitmap.createScaledBitmap(picture, d.getIntrinsicWidth(), d.getIntrinsicHeight(), true); d.setDrawableByLayerId(R.id.picture, new BitmapDrawable(picture)); imageView.setImageDrawable(d); if (!hasPic) hasPic = (imageView.getId() == R.id.ImageView_far); // WTF ? // if (hasPic && (imageView.getId() == R.id.ImageView_far)) { // loadZoom(); // } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }