textView
使用 MotionLayout 将大写动画设置为小写
像 FACTS -> 事实
我成功翻译并更改textColor
了位置,因为我无法在动画期间将所有字母转换为小写
运动场景
<MotionScene
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motion="http://schemas.android.com/apk/res-auto">
<Transition
motion:constraintSetEnd="@+id/end"
motion:constraintSetStart="@id/start"
motion:motionInterpolator="easeIn"
motion:duration="1000">
<KeyFrameSet>
<KeyAttribute>
</KeyAttribute>
</KeyFrameSet>
<OnClick motion:targetId="@+id/test_tv" />
</Transition>
<ConstraintSet android:id="@+id/start">
<Constraint
android:id="@+id/test_tv"
android:layout_height="wrap_content"
motion:layout_constraintEnd_toEndOf="parent"
android:layout_width="wrap_content"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintTop_toTopOf="parent"
android:rotationX="0"
android:rotationY="0"
android:rotation="0">
<CustomAttribute
motion:attributeName="textColor"
motion:customColorValue="#3F51B5" />
<CustomAttribute
motion:attributeName="inputType"
motion:customStringValue="textCapCharacters"/>
</Constraint>
</ConstraintSet>
<ConstraintSet android:id="@+id/end">
<Constraint
android:id="@+id/test_tv"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:scaleX="0.75"
android:scaleY="0.75"
android:layout_marginTop="10dp"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintTop_toBottomOf="@+id/center_horizontal_gl">
<CustomAttribute
motion:attributeName="textColor"
motion:customColorValue="#EC0808" />
<CustomAttribute
motion:attributeName="inputType"
motion:customStringValue="textCapSentences"/>
</Constraint>
</ConstraintSet>
</MotionScene>
我试过使用inputType
,但它不工作,而captialize
被弃用..
我也试过
<CustomAttribute
motion:attributeName="textAllCaps"
motion:customBoolean="false"/>
但不工作..
有人可以为我提供更好的解决方案吗