Не удалось связать файловые ресурсы при использовании Keyboard для Motion Layout
Я получаю
"Не удалось связать файловые ресурсы"
с
"ошибка: тип атрибута (он же com.testapp.client:type) не найден"
При использовании нового MotionLayout, особенно при добавлении элемента KeyPosition в файл сцены.
Мой файл сцены для справки:
<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<Transition
app:constraintSetEnd="@id/collapsed"
app:constraintSetStart="@id/expanded">
<OnSwipe
app:dragDirection="dragUp"
app:touchAnchorId="@id/recyclerview"
app:touchAnchorSide="top" />
<KeyFrameSet>
<KeyAttribute
app:framePosition="60"
app:target="@id/toolbar_image">
<CustomAttribute
app:attributeName="imageAlpha"
app:customIntegerValue="255" />
</KeyAttribute>
<KeyAttribute
app:framePosition="90"
app:target="@id/toolbar_image">
<CustomAttribute
app:attributeName="imageAlpha"
app:customIntegerValue="0" />
</KeyAttribute>
<KeyPosition
app:type="pathRelative"
app:framePosition="50"
app:target="@id/title"
app:percentX="0.9" />
</KeyFrameSet>
</Transition>
<ConstraintSet android:id="@+id/expanded">
<Constraint
android:id="@id/toolbar_image"
android:layout_height="200dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Constraint
android:id="@id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginBottom="24dp"
android:scaleX="1.0"
android:scaleY="1.0"
app:layout_constraintBottom_toBottomOf="@id/toolbar_image"
app:layout_constraintStart_toStartOf="parent" />
</ConstraintSet>
<ConstraintSet android:id="@+id/collapsed">
<Constraint
android:id="@id/toolbar_image"
android:layout_height="?attr/actionBarSize"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Constraint
android:id="@id/title"
android:layout_marginStart="20dp"
android:layout_marginBottom="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleX="0.625"
android:scaleY="0.625"
app:layout_constraintBottom_toBottomOf="@id/toolbar_image"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/toolbar_image" />
</ConstraintSet>
Я пользуюсь стабильной версией Android Studio 3.2, а также версиями поддержки AndroidX и компоновкой ограничений.
Любая помощь приветствуется:)
1 ответ
Не берите в голову:)
Атрибут "тип" в элементе KeyPosition был изменен в альфа-2, чтобы быть "keyPositionType"
Вот фрагмент кода, если у кого-то возникают такие же проблемы:
<KeyPosition
app:keyPositionType="pathRelative"
app:framePosition="50"
app:target="@id/title"
app:percentX="0.9" />
вместо этого:
<KeyPosition
app:type="pathRelative"
app:framePosition="50"
app:target="@id/title"
app:percentX="0.9" />
Довожу до вашего сведения, target
был изменен на motionTarget
в KeyPosition
а также KeyAttribute
В дополнение к тому, что упомянул @Momen
В <Transition ...>
тег motion:interpolator
были изменены на android:interpolator
(Изменение пространства имен от motion
в android
)
пример:
<Transition ...
android:interpolator="@android:anim/accelerate_interpolator">