vendredi 24 août 2018

Checkbox bad display when checked or unchecked

I have a display problem with the checkboxes in the following layout. When I try to check or uncheck them, I get this kind of result: Result of trying to check one of the checkboxes Sometimes, I get a grey or a very small check mark. Moreover, if I managed to check one after clicking on it several times, if I click on another, it will play again animation of the first checkbox. All checkboxes look like "linked" in this situation.

I removed both animateLayoutChanges, but it didn't change anything. I removed scrollView with no result. I also tested this layout on both Android 28 and 23, and it doesn't work only on API 23.

<android.support.constraint.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="match_parent"
    tools:context=".NewOpeningHourActivity"
    android:animateLayoutChanges="true">

<android.support.design.widget.AppBarLayout
    android:id="@+id/appbar_new_opening_hour"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:paddingTop="@dimen/appbar_padding_top"
    android:theme="@style/AppTheme.PopupOverlay"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar_new_opening_hour"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:layout_weight="1"
        android:background="?attr/colorPrimary"
        app:layout_scrollFlags="scroll|enterAlways"
        app:popupTheme="@style/AppTheme.PopupOverlay">

    </android.support.v7.widget.Toolbar>

</android.support.design.widget.AppBarLayout>

<ScrollView
    android:id="@+id/scroll_new_opening_hour"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="1.0"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/appbar_new_opening_hour"
    app:layout_constraintVertical_bias="0.0">

    <android.support.constraint.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <android.support.v7.widget.CardView
            android:id="@+id/cv_new_opening_hour"
            style="@style/CardFoldAppearance"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="16dp"
            android:layout_marginEnd="8dp"
            android:layout_marginStart="8dp"
            android:layout_marginTop="8dp"
            android:animateLayoutChanges="true"
            android:padding="16dp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent">

            <android.support.constraint.ConstraintLayout
                android:id="@+id/ctl_new_opening_hour"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:padding="16dp">

                <TextView
                    android:id="@+id/tv_new_opening_hour_title_days"
                    style="@style/boldMTextAppearance"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginEnd="24dp"
                    android:text="@string/new_openhours_card_days_title"
                    app:layout_constraintEnd_toStartOf="@+id/imagebtn_new_opening_hour_days_fold"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />

                <ImageButton
                    android:id="@+id/imagebtn_new_opening_hour_days_fold"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@android:color/transparent"
                    android:contentDescription="Fold or unfold days list"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintTop_toTopOf="parent"
                    app:srcCompat="@drawable/ic_round_keyboard_arrow_up_24px" />

                <CheckBox
                    android:id="@+id/cbx_new_opening_hour_day_monday"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="8dp"
                    android:text="@string/day_monday"
                    app:layout_constraintTop_toBottomOf="@+id/tv_new_opening_hour_title_days" />

                <CheckBox
                    android:id="@+id/cbx_new_opening_hour_day_tuesday"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/day_tuesday"
                    app:layout_constraintTop_toBottomOf="@+id/cbx_new_opening_hour_day_monday" />

                <CheckBox
                    android:id="@+id/cbx_new_opening_hour_day_wednesday"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/day_wednesday"
                    app:layout_constraintTop_toBottomOf="@+id/cbx_new_opening_hour_day_tuesday" />

                <CheckBox
                    android:id="@+id/cbx_new_opening_hour_day_thursday"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/day_thursday"
                    app:layout_constraintTop_toBottomOf="@+id/cbx_new_opening_hour_day_wednesday" />

                <CheckBox
                    android:id="@+id/cbx_new_opening_hour_day_friday"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/day_friday"
                    app:layout_constraintTop_toBottomOf="@+id/cbx_new_opening_hour_day_thursday" />

                <CheckBox
                    android:id="@+id/cbx_new_opening_hour_day_saturday"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/day_saturday"
                    app:layout_constraintTop_toBottomOf="@+id/cbx_new_opening_hour_day_friday" />

                <CheckBox
                    android:id="@+id/cbx_new_opening_hour_day_sunday"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/day_sunday"
                    app:layout_constraintTop_toBottomOf="@+id/cbx_new_opening_hour_day_saturday" />


            </android.support.constraint.ConstraintLayout>

        </android.support.v7.widget.CardView>
</android.support.constraint.ConstraintLayout>

</ScrollView>

</android.support.constraint.ConstraintLayout>




Aucun commentaire:

Enregistrer un commentaire