android - 更改 MotionLayout 中嵌套布局的尺寸

标签 android kotlin android-layout android-motionlayout

我确实通过使用<include>在MotionLayout中有一个嵌套布局。 .

<androidx.constraintlayout.motion.widget.MotionLayout
...>
   <include android:id="@+id/incl"
        layout="@layout/layout2"/>
    ...
</<androidx.constraintlayout.motion.widget.MotionLayout>

Layout2文件如下:

<androidx.constraintlayout.widget.ConstraintLayout>
    <TextView 
        android:id="@+id/tv1"
        android:text="A"
        android:textSize="16sp"

    />
    <TextView 
        android:id="@+id/tv2"
        android:text="B"
        android:textSize="16sp"

    />
    <TextView 
        android:id="@+id/tv3"
        android:text="C"
        android:textSize="16sp"

    />
</androidx.constraintlayout.widget.ConstraintLayout>

我想要做的是当 MotionLayout 的动画结束时将 textSize 更改为 20 sp。

Motionlayout 动画是基本的,只是一些通过改变尺寸来增长的动画。

最佳答案

MotionLayout 只能为其直接子级的属性设置动画。您可以将您的Views带出内部ConstraintLayout

关于android - 更改 MotionLayout 中嵌套布局的尺寸,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68889548/

相关文章:

android - 为什么我的 SVG 无法在 Vector Asset Studio 中加载

java - Android IntentService 减慢 UI 线程速度

javascript - React-Native-Navigation:未定义已使用但尚未注册

java - android定时器异常onResume

pattern-matching - Kotlin 中元组的模式匹配

java - 以编程方式更改 TextView 对齐方式

android - 如何在主要 Activity api 7 中设置主题?

java - Kotlin:泛型和方差

android - 如何使向上按钮返回而不是打开抽屉导航

android - 无法设置 float 操作按钮的渐变背景