How can I create a layout that has an always present EditText
that obeys the following three rules:
The EditText
view:
- fills the entire parent if no image is present (at runtime, the visibility will be set to
View.GONE
in this case.) - fills 50% of the parent height if the image is taller than it is wide.
- fills the remainder of the parent if the image is wider than it is tall.
The image, of course, is stretched to fit inside the bottommost 50% of the parent rectangle while preserving aspect ratio.