google / flexbox-layout

Flexbox for Android
Apache License 2.0
18.24k stars 1.79k forks source link

Cannot run Espresso tests when using FlexboxLayout/FlexboxLayoutManager + RecyclerView in combination with NestedScrollView #547

Closed j1c1m1b1 closed 4 years ago

j1c1m1b1 commented 4 years ago

Issues and steps to reproduce

Additional Info

Expected behavior

*Tests run without issue

Version of the flexbox library

Link to code

Fragment XML (snippet)

<androidx.core.widget.NestedScrollView
        android:layout_width="0dp"
        android:layout_height="0dp"
        app:layout_constraintBottom_toTopOf="@id/btnApply"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/toolbar">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/rvSorting"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                tools:listitem="@layout/list_item_sort" />

            <include
                android:id="@+id/layoutBrands"
                layout="@layout/layout_brand_selection" />

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/rvFilters"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                tools:listitem="@layout/list_item_filter_group" />
        </LinearLayout>
    </androidx.core.widget.NestedScrollView>

Item XML

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <TextView
        android:id="@+id/groupName"
        style="@style/TextStyle.Headline.NormalCaps"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/margin_normal"
        android:textSize="@dimen/filter_tv_title_text_size"
        app:layout_constraintBottom_toTopOf="@id/flexItems"
        app:layout_constraintEnd_toStartOf="@id/tvShowAll"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        tools:text="Größe" />

    <TextView
        android:id="@+id/tvShowAll"
        style="@style/TextStyle.KeyColor"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginEnd="@dimen/margin_normal"
        android:gravity="end"
        android:text="@string/filter_toggle_all"
        app:layout_constraintBottom_toBottomOf="@id/groupName"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="@id/groupName" />

    <com.google.android.flexbox.FlexboxLayout
        android:id="@+id/flexItems"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/margin_normal"
        android:layout_marginEnd="@dimen/margin_normal"
        android:layout_marginBottom="@dimen/margin_normal"
        app:flexDirection="row"
        app:flexWrap="wrap"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/groupName" />
</androidx.constraintlayout.widget.ConstraintLayout>
j1c1m1b1 commented 4 years ago

The issue was not related to FlexboxLayout I apologise for this.

moshlp commented 1 year ago

@j1c1m1b1 how did you solve it? same issue here