I have an imageview. I want its width to be fill_parent. I want its height to be whatever the width ends up being. For example:
Here's how I solved that problem:
int pHeight = picture.getHeight();
int pWidth = picture.getWidth();
int vWidth = preview.getWidth();
preview.getLayoutParams().height = (int)(vWidth*((double)pHeight/pWidth));
preview - imageView with width setted to "match_parent" and scaleType to "cropCenter"
picture - Bitmap object to set in imageView src.
That's works pretty well for me.