RecyclerView с FlexboxLayoutManager сокращает макет

У меня есть FlexLayout с видом ресайклера. На макете есть кнопка материала.

Когда я обновляю цвет кнопки или текст TypeFace, макет обрезается.

Ниже я использую версию flexbox

implementation 'com.google.android:flexbox:2.0.1'
  FlexboxLayoutManager layoutManager = new FlexboxLayoutManager(context);
        layoutManager.setFlexDirection(FlexDirection.ROW);
        layoutManager.setJustifyContent(JustifyContent.SPACE_EVENLY);
        layoutManager.setFlexWrap(FlexWrap.WRAP);
        recyclerViewFlex.setLayoutManager(layoutManager);
        recyclerViewFlex.setAdapter(flexAdapter);

Компоновка адаптера просмотра ресайклера

<?xml version="1.0" encoding="utf-8"?>
<com.google.android.flexbox.FlexboxLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:id="@+id/layout_flex"
    android:layout_height="wrap_content"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    app:flexWrap="wrap"
    app:alignContent="space_between">

    <com.google.android.material.button.MaterialButton
        style="@style/Widget.MaterialComponents.Button"
        android:id="@+id/btn_flex_tag"
        app:layout_alignSelf="center"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/txt_hello"
        android:textColor="@color/color_black"
        android:fontFamily="@font/work_sans_light"
        app:rippleColor="@color/primaryColor"
        app:backgroundTint="@color/color_white"
        app:iconTintMode="screen"
        app:iconTint="@color/color_transparent"
        app:elevation="@dimen/dimen_20dp"
        app:icon="@drawable/ic_iconplus"/>

</com.google.android.flexbox.FlexboxLayout>

Как снова отобразить гибкий макет после notifyDataSetChanged?

0 ответов

Другие вопросы по тегам