Я использую implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta1'
, и у меня включена привязка данных.
Когда мой взгляд
<ImageView
android:id="@+id/im_lightning"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="4dp"
android:contentDescription="@string/charging"
android:src="@drawable/ic_lightning"
android:visibility="@{batteryViewModel.liveData.charging ? View.VISIBLE : View.GONE}"
app:layout_constraintBottom_toBottomOf="@id/tv_percent"
app:layout_constraintRight_toLeftOf="@id/tv_percent"
app:layout_constraintTop_toTopOf="@id/tv_percent"
app:layout_constraintVertical_bias="1.0" />
Оборачивается вокруг макета координатора, изменения его видимости происходят должным образом. Как только я оборачиваю его в MotionLayout, изменения видимости перестают работать, как раньше. Если быть точным, вид не отображается, когда должен быть. Он становится видимым на секунду после запуска события, а затем снова становится невидимым. Это известная ошибка?
Код на случай, если понадобится:
Схема координатора:
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorBackground">
<ImageView (same as above) />
</androidx.constraintlayout.widget.ConstraintLayout>
Макет движения:
<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"
tools:context=".ui.MainActivity">
<androidx.constraintlayout.motion.widget.MotionLayout
android:id="@+id/motion_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorBackground"
app:layoutDescription="@xml/home_scene_0"
app:showPaths="true">
<ImageView (same as above) />
</androidx.constraintlayout.motion.widget.MotionLayout>
<data>
<import type="android.view.View" />
<variable
name="batteryViewModel"
type="rish.crearo.minimalphone.viewmodels.BatteryViewModel" />
</data>
</layout>