I'm using implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta1'
, and have databinding enabled.
When my view
<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" />
is wrapped around a coordinator layout, its visibility changes occur as expected. As soon as I wrap it in a MotionLayout, the visibility changes don't work as before. To be precise, the view isn't visible when it should be. It becomes visible for a second upon triggering an event and then goes back to invisible. Is this a known bug?
The code in case it's needed:
Coordinator Layout:
<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>
Motion Layout:
<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>