Android флажок без галочки на смартфоне (эмулятор работает) - PullRequest
0 голосов
/ 31 января 2020

У меня есть несколько флажков, которые не работают правильно. Результат флажков отмечен, но флажков нет. Если дважды нажать на флажок, появится флажок. На эмуляторе проблем нет, но на моем Galaxy S7 (Oreo) есть этот баг. Флажки проверяются программно после загрузки данных из базы данных:

    @Override
    protected void onPostExecute(Boolean successo) {
        pbGestioneProfilo.setVisibility(View.GONE);
        if (successo) {
            passioniET.setText(passioni);
            libriET.setText(libri);
            filmserieET.setText(filmserie);
            negoziET.setText(negozi);
            tecnologiaCB.setChecked(tecnologia.equals(Utils.TRUE) ? true : false);
            sportCB.setChecked(sport.equals(Utils.TRUE) ? true : false);
            viaggiCB.setChecked(viaggi.equals(Utils.TRUE) ? true : false);
            casacucinaCB.setChecked(casacucina.equals(Utils.TRUE) ? true : false);
            abbigliamentoCB.setChecked(abbigliamento.equals(Utils.TRUE) ? true : false);
            if (!urlProfilo.equals("")) {
                Glide.with(getContext())
                        .load(urlProfilo)
                        .into(imgprofilo);
            }
        } else {
            Log.d("MYTAG","ERROR");
            Toast.makeText(getContext(),"Error",Toast.LENGTH_SHORT).show();
        }
    }

Вкл. xml:

<ScrollView
    android:background="@drawable/backgroundtab"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:fbutton="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools">


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

...

    <CheckBox
        android:id="@+id/tecnologiaCB"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="32dp"
        android:layout_marginTop="8dp"
        android:text="Tecnologia"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/interessiTV" />

    <CheckBox
        android:id="@+id/sportCB"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="32dp"
        android:text="Sport"
        app:layout_constraintBaseline_toBaselineOf="@+id/tecnologiaCB"
        app:layout_constraintStart_toEndOf="@+id/tecnologiaCB" />

    <CheckBox
        android:id="@+id/viaggiCB"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="32dp"
        android:text="Viaggi"
        app:layout_constraintBaseline_toBaselineOf="@+id/tecnologiaCB"
        app:layout_constraintStart_toEndOf="@+id/sportCB" />

    <CheckBox
        android:id="@+id/casacucinaCB"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:text="Casa e Cucina"
        app:layout_constraintStart_toStartOf="@+id/tecnologiaCB"
        app:layout_constraintTop_toBottomOf="@+id/tecnologiaCB" />

    <CheckBox
        android:id="@+id/abbigliamentoCB"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Abbigliamento"
        app:layout_constraintBaseline_toBaselineOf="@+id/casacucinaCB"
        app:layout_constraintStart_toStartOf="@+id/sportCB" />

</androidx.constraintlayout.widget.ConstraintLayout>

</ScrollView>

Возможно ли исправить? Спасибо

enter image description here

...