#android #android-motionlayout
Вопрос:
Я могу воспроизвести переход в первый раз, но он не запускается во второй раз.
lt;?xml version="1.0" encoding="utf-8"?gt; lt;androidx.constraintlayout.motion.widget.MotionLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@ id/ml_pk_gift_layout" android:layout_width="match_parent" android:layout_height="match_parent" app:layoutDescription="@xml/pk_gift_layout_scene"gt; lt;androidx.constraintlayout.widget.Guideline android:id="@ id/guideline_1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" app:layout_constraintGuide_percent="0.40" /gt; lt;View android:id="@ id/view" android:layout_width="0dp" android:layout_height="0dp" app:layout_constraintBottom_toBottomOf="@id/iv_pk_gift" app:layout_constraintDimensionRatio="H,2:1" app:layout_constraintEnd_toEndOf="@id/iv_pk_gift" app:layout_constraintStart_toStartOf="@id/iv_pk_gift" /gt; lt;androidx.constraintlayout.widget.ConstraintLayout android:id="@ id/cl_pk_gift_layout" android:layout_width="0dp" android:layout_height="wrap_content" android:background="@drawable/blue_pk_gift_back" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="@id/guideline_1" app:layout_constraintTop_toTopOf="@id/view"gt; lt;com.google.android.material.imageview.ShapeableImageView android:id="@ id/si_gift_dp" android:layout_width="40dp" android:layout_height="40dp" android:layout_marginStart="@dimen/margin_16" android:layout_marginTop="@dimen/margin_8" android:layout_marginEnd="@dimen/margin_16" android:layout_marginBottom="@dimen/margin_8" android:src="@drawable/ic_user" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.App.CornerSize50Percent" /gt; lt;androidx.appcompat.widget.AppCompatTextView android:id="@ id/tv_pk_host_name" style="@style/textStylePopinWhiteBold_14sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="@dimen/margin_24" android:layout_marginEnd="@dimen/margin_8" android:text="Mangesh" android:textColor="@color/black" app:layout_constraintBottom_toTopOf="@id/tv_pk_sent_gift" app:layout_constraintEnd_toStartOf="@id/si_gift_dp" app:layout_constraintTop_toTopOf="@id/si_gift_dp" /gt; lt;androidx.appcompat.widget.AppCompatTextView android:id="@ id/tv_pk_sent_gift" style="@style/textStylePopinWhiteMedium_12sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="@dimen/margin_24" android:layout_marginEnd="@dimen/margin_8" android:text="Sent a gift" android:textColor="@color/black" app:layout_constraintBottom_toBottomOf="@id/si_gift_dp" app:layout_constraintEnd_toStartOf="@id/si_gift_dp" app:layout_constraintTop_toBottomOf="@id/tv_pk_host_name" /gt; lt;/androidx.constraintlayout.widget.ConstraintLayoutgt; lt;androidx.appcompat.widget.AppCompatImageView android:id="@ id/iv_pk_gift" android:layout_width="40dp" android:layout_height="40dp" android:layout_marginStart="48dp" android:src="@drawable/fire" app:layout_constraintStart_toStartOf="@id/cl_pk_gift_layout" app:layout_constraintTop_toTopOf="parent" /gt; lt;/androidx.constraintlayout.motion.widget.MotionLayoutgt;
найдите ниже сцену макета
lt;?xml version="1.0" encoding="utf-8"?gt; lt;MotionScene xmlns:android="http://schemas.android.com/apk/res/android" xmlns:motion="http://schemas.android.com/apk/res-auto"gt; lt;Transition motion:constraintSetEnd="@ id/end" motion:constraintSetStart="@id/start" motion:duration="1500" motion:motionInterpolator="linear" motion:autoTransition="animateToEnd"gt; lt;KeyFrameSetgt; lt;/KeyFrameSetgt; lt;/Transitiongt; lt;ConstraintSet android:id="@ id/start"gt; lt;Constraint android:id="@ id/cl_pk_gift_layout" android:layout_width="0dp" android:layout_height="wrap_content" motion:layout_constraintTop_toTopOf="@id/view" motion:layout_constraintStart_toEndOf="parent" android:visibility="visible" /gt; lt;Constraint android:id="@ id/iv_pk_gift" android:layout_width="40dp" android:layout_height="40dp" android:layout_marginStart="48dp" motion:layout_constraintTop_toTopOf="parent" motion:layout_constraintStart_toStartOf="@id/cl_pk_gift_layout" android:visibility="visible" /gt; lt;/ConstraintSetgt; lt;ConstraintSet android:id="@ id/end"gt; lt;/ConstraintSetgt;
это мой код котлина
pkGiftLayout?.visibility = View.VISIBLE if (pkGiftLayout?.si_gift_dp != null) ImageUtil.loadShapeAbleProfileImage( requireContext(), pkGiftLayout.si_gift_dp, EloEloConstants.getImageUrl() gift.FromAvatar ) pkGiftLayout?.tv_pk_host_name?.text = gift.fromFirstName if (pkGiftLayout.iv_pk_gift != null) Gifts.showSentItemIcon( gift.giftTitle, pkGiftLayout.iv_pk_gift ) pkGiftLayout?.ml_pk_gift_layout?.setTransition(R.id.start, R.id.end)
приведенный выше код находится в наблюдателе, и я получаю обратный вызов здесь, но переход не выполняется. Пожалуйста, помогите мне с этим. Я думаю, что sas sfd sfdf dsa ds dsds dsads dsa dsa dsa dsa dsadsa dsa dd ds sa fsa dsads dsa dsa dsa dsa fdsaf dsafd fdsafds fda fdsa fdsa fdsa das dsaf dsa dsa dsa fas fdsf dsa fdsa fdsa dsa das dsa f sfdsa sa fds fds fdsa
Комментарии:
1. нужна помощь в этом