问题标签 [android-motionlayout]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
android - MotionLayout setTransition() 总是调用 transitionToStart()
使用MotionLayout
,我需要暂时转换到加载状态( ConstraintSet
),我通过调用:
然后我想转换回我的XMLTransition
中声明的默认值:MotionScene
当我想通过设置endState
调用来恢复默认行为时,问题就来了:
这里的问题是setTransition(int beginId, int endId)
也调用transitionToStart()
, 以一种奇怪的方式再次对其进行动画处理。
所以我的问题是,是否有任何方法可以在不打电话的setTransition()
情况下打电话transitionToStart()
?
android - 具有 3 个视图和屏障的 MotionLayout
我想用 3 张卡片创建一些视图:
- 带有某些对象详细信息的顶部卡片
- 左右卡片仅包含主要信息。
如果我单击左卡或右卡,则它会出现在顶部卡的位置(卡交换位置)
但是如果我点击右边的卡片,那么动画看起来很奇怪
首先在一些动画之后它看起来像预期的那样
对于动画,我创建了运动场景
和运动布局
在我的片段中,我根据上一个动画设置动画
我哪里错了?
是不是因为第一个动画没有渲染的屏障?
我该如何解决?
请帮忙。
android - 是否可以使用 MotionLayout 为组的可见性设置动画?
我正在尝试使用 MotionLayout 制作动画,我需要隐藏一些元素。我在单个元素中测试了可见性属性并且它有效,但是为了使 XML 更短,我希望能够仅指定一个包含所有这些元素的组(来自 ConstraintLayout 助手)
像这样的东西
但是它不起作用,知道如何使它起作用吗?
另外,我不希望使用 alpha,因为所有约束都已设置,因此当它们消失时,容器会调整大小
android - 淡入淡出在 MotionLayout 中不起作用
我正在尝试使用 alpha 和 motionLayout 制作淡入、淡出的效果,但它似乎不起作用。
这是我要淡出的 imageView。
这是运动文件
我可以看到图像,但它没有做 alpha 输入和输出。任何想法?我需要触发它才能启动吗?
android - Multiple view click events using nested constraint layout (2.0.0 beta 2)
I have created my layout with ConstraintLayout
and as ConstraintLayout
allows you to build complex layouts without having to nest View. In my case, I want multiple view click events.
I have tried using Group
as you can get a list of ids that are members of your Group
in your code and set click listener.
However, this does not seem to work as of the ConstraintLayout
version 2.0.0-beta2
. This code is working till 2.0.0-alpha3
. I have implemented using multiple ConstraintLayout
so is it alright to use nested constraint layout?
I am using MotionLayout
and other animation of constraint layout so I can't use a lower version of ConstraintLayout
.
android - MotionLayout 忽略 KeyFrameSet
我正在尝试为动画的第一部分旋转一个 topCard,并为第二个部分旋转一个 bottomCard。要持有bottomCard,直到我使用KeyFragmentSet。当我单击 topCard 时,MotionLayout 会忽略 KeyFragmentSet 并在整个动画时间内同时旋转两张卡片。
尝试用 setOnClickListener 替换 XML onClick,但同样的事情发生了。
运动场景:
xml布局:
我用:
实施 'com.android.support.constraint:constraint-layout:2.0.0-beta2'
我希望 topCard rotateY 首先从 0 到 90,bottomCard rotateY 最后从 -90 到 0
android - MotionLayout:如何限制特定视图上的“OnSwipe”事件而不是整个屏幕上的“OnSwipe”
我有一个带有以下“layoutDescription”(场景文件)的运动布局
我在这里期望的是,如果用户将“按钮”拖向左侧,那么它应该执行转换,但实际发生的是当用户从屏幕上的任何位置向左拖动(向左滑动)时,这个转换就会被执行!
如何限制动画仅在拖动指定视图时起作用?
(我使用“constraintlayout:2.0.0-beta2”)
android - 运动布局。OnSwipe 无法正确处理拖动事件。根本问题是什么?
所以,我有一个简单的场景:
如您所见,在过渡中,我使用dragDirection“dragUp”进行滑动处理。但问题是它作为dragDown工作,不明白为什么。我尝试将dragDirection 设置为dragDown,但它按预期工作。方向处理有问题吗?
这是我的布局:
你现在为什么我可能会遇到这个问题?
android - android:对 MotionLayout 子项的可见性更改
我一定错过了 android:visibility 在动作布局中的变化。这是我的布局的简化版本。
我有一个motionScreen,它基于回收器视图设置一个Transition onswipe,以降低HeaderBackground 的高度并隐藏一些图像/文本视图(即折叠工具栏)。但是,如果有一些致命错误,我想在 RecyclerView 的顶部/前面显示 CustomViewGroup1,但是将 RecyclerView 的可见性切换为消失并且将 CustomViewGroup1 切换为可见不会使 CustomViewGroup1 显示。
我可以将 CustomViewGroup 组移出 MotionLayout 并添加一个框架布局作为活动的根并隐藏整个 MotionLayout。但这不太理想,因为我必须复制工具栏和图标。所以我想问题是关于可见性变化和潜在的 z 排序?
我在用着androidx.constraintlayout:constraintlayout:2.0.0-beta2
android - MotionLayout MotionHelper 淡出故障
当尝试在运动布局中淡出 TextView 时,TextView 出现故障,如 gif 所示
该活动通常遵循 Android 开发人员提供的关于MotionLayouts 和片段转换的示例。
TextView 的位置不会改变,它被定义为在片段中居中。
有没有人遇到过这个故障?任何意见将不胜感激。