App/에러

[안드로이드] java.lang.IllegalStateException: Pages must fill the whole ViewPager2 (use match_parent)

Say simple 2020. 8. 27. 18:44
728x90
반응형

뷰페이저의 가장 상위 자식의 layout_width, layout_height의 크기가 match_parent가 아닐 때 나타나는 오류이다.

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

    <ImageView
        android:id="@+id/item_start_image"
        android:layout_width="match_parent"
        android:layout_height="350dp"
        app:layout_constraintTop_toTopOf="parent" />

    <TextView
        android:id="@+id/item_start_tv_1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textSize="20sp"
        android:textStyle="bold"
        android:textColor="#202020"
        android:textAlignment="center"
        app:layout_constraintTop_toBottomOf="@id/item_start_image" />

    <TextView
        android:id="@+id/item_start_tv_2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="20dp"
        android:textSize="16sp"
        android:textAlignment="center"
        app:layout_constraintTop_toBottomOf="@id/item_start_tv_1" />

</androidx.constraintlayout.widget.ConstraintLayout>

 

생각보다 간단한 오류인데 해결하는데 애먹었다...

728x90
반응형