Hi, does anyone know how to create a custom Carous...
# android
r
Hi, does anyone know how to create a custom Carousel in Epoxy? I’m trying to subclass it to get a vertical list of elements by settings LinearLayoutManager as its layout manager.
Copy code
@ModelView(autoLayout = ModelView.Size.MATCH_WIDTH_WRAP_HEIGHT)
public class VerticalLayoutCarousel extends Carousel {

    public VerticalLayoutCarousel(Context context) {
        super(context);
    }

    @NotNull
    @Override
    protected LayoutManager createLayoutManager() {
        return new LinearLayoutManager(getContext(), 1, GridLayoutManager.VERTICAL, false);
    }
}
But if I use it during runtime it throws android.view.InflateException (with the default Carousel I got no error)
Copy code
<?xml version="1.0" encoding="utf-8"?>
<layout 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>">

    <data>

    </data>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <TextView
            android:id="@+id/title"
            ... />

        <com.example.app.VerticalLayoutCarousel
            android:id="@+id/products"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/margin_normal"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/title"
            tools:listitem="@layout/item_product" />

    </androidx.constraintlayout.widget.ConstraintLayout>
</layout>
Thanks in advance!
google 1
stackoverflow 1