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:
You can't do it with the layout alone, I've tried. I ended up writing a very simple class to handle it, you can check it out on github. SquareImage.java Its part of a larger project but nothing a little copy and paste can't fix (licensed under Apache 2.0)
Essentially you just need to set the height/width equal to the other dimension (depending on which way you want to scale it)
Note: You can make it square without a custom class using the scaleType attribute but the view's bounds extend beyond the visible image, which makes it an issue if you are placing other views near it.