Это мое приложение, где существует проблема
Я хочу, чтобы мои элементы соответствовали этому приложению
Я используюRecyclerView
с GridLayoutManager
.Моя проблема, как вы видите на изображении, что элементы сетки не имеют одинаковую высоту, когда один из элементов имеет более длинный текст.Я загружаю данные из firebase и уведомляю Adapter
, когда в списке есть данные.Я попробовал все, но не могу найти решение для автоматической подгонки элементов, таких как второе изображение.Любая помощь, пожалуйста?
Вот мой макет пункта просмотра переработчика
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layoutDirection="rtl"
>
<android.support.v7.widget.CardView
android:layout_height="wrap_content"
android:layout_width="match_parent"
app:cardCornerRadius="10dp"
android:layout_margin="5dp"
app:cardBackgroundColor="#fff"
app:cardElevation="5dp"
>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/cartoonImg"
android:layout_width="match_parent"
android:layout_height="120dp"
android:scaleType="fitXY"
app:imgUrl="@{cartoon.thumb}"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
tool:text="Cartoon Name"
android:gravity="center"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_marginRight="2dp"
android:layout_marginLeft="2dp"
android:textColor="@color/colorPrimary"
android:text="@{cartoon.title}" />
</LinearLayout>
</android.support.v7.widget.CardView>
</FrameLayout>