对于ImageView来说,要让它设置的MaxWidth和MaxHeight能够生效,必须满足如下两点:

1.加上setAdjustViewBounds(true)。

2.设置它的layout_width/layout_height为“wrap_content”。(wrap_content表示可以

根据视图内部内容自动扩展以适应其大小)