I\'m trying to place in single row the EditText
with the ImageView
on the left. But I can\'t get the image to be scaled properly to match the height of
This is a LinearLayout bug. If you look at forceUniformHeight
in the source here. You can see that to handle sizing child views which supply match_parent
as the height when the LinearLayout is set to wrap_content
, the LinearLayout pretends to have an absolute height, recalculates the child height and then reuses the child width from the previous measure pass. Basically your image is calculating height and width unconstrained and getting default width and height, and then having height recalculated but being forced to use the old width. You will need to supply a height or override some View onMeasures
you can also put gravity to be centered on the linear layout
NOTE: that you should also have different images in drawables-hdpi/ldpi and mdpi