gpt4 book ai didi

android - 如何设置网格图像具有统一的高度和宽度

转载 作者:行者123 更新时间:2023-11-30 04:50:40 24 4
gpt4 key购买 nike

friend 的 我有一个任务来解析缩略图并将其设置在 GridView 中,其中 url 图像内容具有不同的高度和宽度(某些图像为 60*60 或 110*80),我如何在网格中设置图像统一的高度和宽度。

提前致谢。

最佳答案

为 ListAdapter 创建的 View 提供足以满足最大尺寸的固定宽度和高度的布局,然后将 ImageView 置于内部居中,例如:

<RelativeLayout 
android:id="@+id/RelativeLayout01"
android:layout_width="100dip"
android:layout_height="80dip"
xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView
android:id="@+id/imageView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="centerInside">
</ImageView>
</RelativeLayout>

关于android - 如何设置网格图像具有统一的高度和宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3565066/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com