android imageview 图片宽度自适应问题
============问题描述============
大家好:
使用imageview 图片宽度自适应的问题,困扰很长时间
目前代码是:
<ImageView android:clickable="true" android:padding="0dip" android:scaleType="fitCenter" android:layout_marginTop="5dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginBottom="5dip" android:id="@+id/TrendFileImageView" />
出现以下问题
图片宽度大于view,则可以宽度自适应,但高度不好控制,相当于高度未自适应(这个高度指view的高度),view还有空白。
当图片宽度小于view时,又填充不满
主要是想实现web网页加载图片的效果,就是设置图片100%,高度自适应。
============解决方案1============
layout_height:wrap_content
layout_width:wrap_content
浙公网安备 33010602011771号