Ken Zira
Ken Zira

Reputation: 1176

View disappears when apply ConstraintSet in Constraintlayout android

At the beginning, the ImageView is horizontally center. I'm moving the View to the left in Kotlin. After applying, the ImageView disappears. I don't have any clue to debug this issue

enter image description here

 override fun onViewCreated(view: View, savedInstanceState: Bundle?){
        super.onViewCreated(view, savedInstanceState)
        applyConstraintSet.clone(vConstraint)

}

  private fun startAnimation() {
     applyConstraintSet.setHorizontalBias(R.id.ivAvatar, 0.2F)

     val transition = AutoTransition()
         transition.duration = 1500
         transition.interpolator = AccelerateDecelerateInterpolator()

TransitionManager.beginDelayedTransition(vConstraint, transition)

     applyConstraintSet.applyTo(vConstraint)

}

XML

<android.support.constraint.ConstraintLayout
    android:id="@+id/vConstraint"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


    <com.facebook.drawee.view.SimpleDraweeView
        android:id="@+id/ivAvatar"
        android:layout_width="64dp"
        android:layout_height="64dp"
        android:layout_marginBottom="84dp"
        android:scaleX="0"
        android:scaleY="0"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toStartOf="parent"
        fresco:roundAsCircle="true" />


</android.support.constraint.ConstraintLayout>

Upvotes: 0

Views: 738

Answers (1)

aids61517
aids61517

Reputation: 21

I have the same question today. I fixed it by adding id for all children of ConstraintLayout. It works for me in version 1.0.2

Upvotes: 1

Related Questions