Я пытаюсь сдвинуть ImageView вправо, используя анимацию translationX на RadioButton.Вот макет, который я создал:
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<RadioButton
android:id="@+id/radio_button"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="10dp"
app:layout_constraintEnd_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
/>
<ImageView
android:id="@+id/image"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_margin="15dp"
android:background="@drawable/my_image"
app:layout_constraintStart_toEndOf="@id/radio_button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="8:5"
/>
, который начинается так:
![Image with no visible RadioButton](https://i.stack.imgur.com/OvaRj.png)
Затем я запускаю эту анимацию программно:
radioButton.animate().translationX(50).setDuration(500).start();
Ожидая что-то вроде: (Обратите внимание, что ширина и высота уменьшены в этом предварительном просмотре, учитывая layout_constraintDimensionRatio = "8: 5")
![Expected result](https://i.stack.imgur.com/tDJmU.png)
Но, к сожалению, только RadioButton переводит (и заканчивается позади изображения), в то время как ImageView остается того же размера и в том же положении.Можете ли вы помочь мне понять, почему это происходит?
Я думал, что ключевая инструкция была app:layout_constraintStart_toEndOf="@id/radio_button"
в ImageView, но я думаю, что я что-то упускаю.
Любая помощь приветствуется, спасибовы все