初学安卓,做一个东西的时候,用weight分成两列之后,ImageView填充图片的时候发现不能拉伸,有空隙看着挺难看的。

发现有一个属性是用来拉伸图片的:

直接上代码

android:layout_width="wrap_content"

android:layout_height="80dp">

android:scaleType="fitXY"

android:layout_width="wrap_content"

android:layout_height="match_parent"

android:layout_weight="1"

android:src="@drawable/i5"/>

android:scaleType="fitXY"

android:layout_width="wrap_content"

android:layout_height="match_parent"

android:layout_weight="1"

android:src="@drawable/i6"/>

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐