我有一个典型的回收站适配器。适配器中的某些项目具有图像,有时只有一张图像,最多12张。我想显示图像,如下图所示,具体取决于每件图像的数量:当前,我使用了不同的布局文件来显示不同的图像集。但是问题是图像大小各异,仅使用GLIDE库显示图像时,我才为4张图像定义了设置。
如果图像为4的代码,它们将调整为更大的图像尺寸
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="3"
android:minHeight="@dimen/dp_200"
android:orientation="horizontal">
<ImageView
android:id="@+id/image4"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:adjustViewBounds="true"
android:contentDescription="@string/content_desc"
android:scaleType="fitXY" />
<ImageView
android:id="@+id/image5"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:adjustViewBounds="true"
android:contentDescription="@string/content_desc"
android:scaleType="fitXY" />
<ImageView
android:id="@+id/image6"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:adjustViewBounds="true"
android:contentDescription="@string/content_desc"
android:scaleType="fitXY" />
</LinearLayout>
我正在寻找应该与目标API 29一起使用的任何可用库。以前的解决方案不适用于较新的目标API。