Răzvan Roșu
08/21/2020, 5:40 PM@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)
<?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!