【发布时间】:2020-02-02 11:45:37
【问题描述】:
我有两个布局文件,用于使用运动布局进行开始和结束转换。
文本按照预期移动,基于开始布局文件到结束布局文件。但是文本大小不会改变,即使在两种布局中定义了不同的文本大小。
有人可以帮忙吗?文件已提供如下:
motion_layout_start.xml
<androidx.constraintlayout.motion.widget.MotionLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:showPaths="true">
<TextView
android:id="@+id/title"
android:layout_width="@dimen/match_constraints"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/description"
android:text="HEADING"
style="@style/TextStyle.Title"
app:layout_constraintVertical_chainStyle="packed"
app:layout_constraintVertical_bias="0"/>
<TextView
android:id="@+id/description"
android:layout_width="@dimen/match_constraints"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/title"
app:layout_constraintBottom_toTopOf="@+id/recycler_view"
tools:text="DESCRIPTION"
style="@style/TextStyle.DESC"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_height="@dimen/match_constraints"
android:layout_width="match_parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/description"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.motion.widget.MotionLayout>
motion_layout_end.xml
<androidx.constraintlayout.motion.widget.MotionLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:showPaths="true">
<TextView
android:id="@+id/title"
android:layout_width="@dimen/match_constraints"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/recycler_view"
android:text="HEADING"
style="@style/TextStyle.SmallTitle"
app:layout_constraintVertical_chainStyle="packed"
app:layout_constraintVertical_bias="0"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_height="@dimen/match_constraints"
android:layout_width="match_parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/title"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.motion.widget.MotionLayout>
运动xml文件 fragment_motion.xml
<MotionScene xmlns:app="http://schemas.android.com/apk/res-auto">
<Transition
app:constraintSetStart="@layout/motion_layout_start"
app:constraintSetEnd="@layout/motion_layout_end">
<OnSwipe app:touchAnchorSide="top"
app:touchAnchorId="@id/recycler_view"
app:dragDirection="dragUp"
app:moveWhenScrollAtTop="true"/>
</Transition>
</MotionScene>
谢谢
【问题讨论】:
-
有人吗?......
标签: android android-view android-transitions android-motionlayout