What is the best way to retrieve the dimensions of the Drawable in an ImageView?
My ImageView
has an Init-Method where I create the ImageView
:
private void init() {
coverImg = new ImageView(context);
coverImg.setScaleType(ScaleType.FIT_START);
coverImg.setImageDrawable(getResources().getDrawable(R.drawable.store_blind_cover));
addView(coverImg);
}
At some point during the layout oder measure process I need the exact dimensions of the Drawable to adjust the rest of my Components around it.
coverImg.getHeight()
and coverImg.getMeasuredHeight()
don't return the results that I need and if I use coverImg.getDrawable().getBounds()
I get the dimensions before it was scaled by the ImageView
.
Thanks for your help!