多少难熬的我都熬过去了,如今的我不闻不问不痛不痒又凭什么不快乐。
ImageView设置 maxWidth/maxHeight和adjustViewBounds
在使用ImgaView的时候,我们往往会在布局文件中设置maxWidth/maxHeight,maxWidth/maxHeight是用来设置ImageView可以显示的最大宽/高,但是在Android机制中,只用当设置adjustViewBounds="ture"的时候,maxWidth/maxHeight设置效果才能有效。
官方api解释:An optional argument to supply a maximum width for this view. Only valid if setAdjustViewBounds(boolean) has been set to true.
那么adjustViewBounds="ture"是什么意思呢?
当adjustViewBounds="ture"的时候,Adjust the ImageView's bounds to preserve the aspect ration of its drawable。什么意思呢?意思是说通过调整ImageView的界限来保持图片的宽高比例。这里的比例是指图片(真正需要加载的图片)宽高的比例,而非ImageView比例,简单来说adjustViewBounds="ture"的时候&#