- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个类似 View 的 Youtube 视频播放器,其中有一个列表,点击后会在下一个屏幕上播放视频。
我已将 Motionscene 添加到视频 View 中,因此在向下拖动时,视频 View 会变小。但这样做时,onClick 或 onTouch 事件不适用于播放/暂停控件。
在 youtube 上,我们可以看到两者都运行良好。所以我想知道我哪里出错了。
运动场景:
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motion="http://schemas.android.com/apk/res-auto">
<Transition
motion:constraintSetEnd="@id/collapsed"
motion:constraintSetStart="@id/expanded"
motion:duration="100">
<OnSwipe
motion:dragDirection="dragDown"
motion:maxAcceleration="200"
motion:touchAnchorId="@+id/player"
motion:touchAnchorSide="bottom" />
</Transition>
<ConstraintSet android:id="@+id/expanded">
<Constraint
android:id="@id/player"
android:layout_height="200dp"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintTop_toTopOf="parent" />
<Constraint
android:id="@id/scrollView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:visibility="visible"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintTop_toBottomOf="@id/player" />
</ConstraintSet>
<ConstraintSet android:id="@+id/collapsed">
<Constraint
android:id="@id/player"
android:layout_height="85dp"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintStart_toStartOf="parent" />
<Constraint
android:id="@id/scrollView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:visibility="gone"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintTop_toBottomOf="@id/player" />
</ConstraintSet>
</MotionScene>
<androidx.constraintlayout.motion.widget.MotionLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutDescription="@xml/youtube_scene"
tools:context=".ProfileActivity"
tools:showPaths="true">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/player"
android:layout_width="match_parent"
android:layout_height="200dp"
app:layout_constraintBottom_toTopOf="@id/scrollView"
app:layout_constraintTop_toTopOf="parent">
<FrameLayout
android:id="@+id/control"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:elevation="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/stop"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:contentDescription="@string/app_name"
android:src="@drawable/pause"
android:visibility="gone" />
<ImageView
android:id="@+id/start"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:contentDescription="@string/app_name"
android:src="@drawable/play"
android:visibility="gone" />
</FrameLayout>
<ImageView
android:id="@+id/videoView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#B3000000"
android:contentDescription="@string/app_name" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/player">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_gravity="center"
android:background="#dff"
android:gravity="center"
android:text="@string/app_name" />
</LinearLayout>
</ScrollView>
</androidx.constraintlayout.motion.widget.MotionLayout>
@Override
public void onClick(View v) {
onVideoClick();
}
});
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
最佳答案
我通过将所需元素包装在 NestedScrollView 中解决了这个问题
app:layoutDescription="@transition/profile_animations_user_other"
app:showPaths="false">
<androidx.core.widget.NestedScrollView
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/divider">
<LinearLayout ..../>
</androidx.core.widget.NestedScrollView>
<Transition
app:constraintSetEnd="@id/end"
app:constraintSetStart="@id/start"
app:duration="1000">
<OnSwipe
app:dragDirection="dragUp"
app:touchAnchorId="@id/view_pager"
app:touchAnchorSide="top" />
<OnSwipe
app:dragDirection="dragUp"
app:touchAnchorId="@id/toolbar"
app:touchAnchorSide="top" />
</Transition>
关于android - 运动布局 : Click and Touch not working in view with transition in motion scene (Youtube player like UI),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57679282/
我想在我的网络应用程序中添加一些页面转换。问题是退出动画不起作用。 我有一个运动组件 // app/components/Motion.tsx import React from "react"
我在 Next.js 环境中并用 . 包装了我的 _app.js 在一个页面中,我有一个基本的路由设置,可以从第 1 页跳转到第 2 页。 在每个页面上我都有一个 Action h1 看起来像。因此有
Leap Motion API 仅支持四种标准手势:圆圈、滑动、按键和屏幕点击。在我的应用程序中,我需要其他手势,但我不知道如何添加它们,或者是否可以添加更多手势。我阅读了 API 并没有帮助。 在我
实验1 打开Vim,然后仅在缓冲区中插入以下文本行。 hello world 换句话说,按i,键入hello world,然后按Esc。 按0将光标定位在第一行的第一个字符处。 按e。光标移动到o。
我发现 yoyo 和 repeat 在 framer-motion 中完全相同。我找不到有关 yoyo 的任何文档。仅记录重复。 transition:{{yoyo:3}} transition:{{
我正在尝试使用 calc() 完成以下操作在模板字符串中: {style => ( )} 这里的问题是模板文字中有一个模板文字,我不知道如何避免这个问题以使动画正常工作。 我需要
简而言之,我让 Kinect 捕捉我的 Action ,我创建了一个漂亮的骨架,这样我就可以轻松地看到我的向前/向后/左右移动。我想采取这些向前/向后/左右移动并将其转换为屏幕上的上下或左右移动。换句
在编译器中,短语 "loop-invariant code motion"描述循环中的表达式或代码语句,它们不会随迭代而改变,因此可以移到循环之外以进行一次计算。 我理解短语的“循环不变”部分,但“代
对于一个用 ST 编写的 motionPLC 项目,我使用了很多这样的步进结构函数: stepNum := 1; CASE stepNum OF 1: (* Move axis to upper po
所以我正在开发一个 21 点游戏,我编写了一个渲染过程,它将渲染一张牌从牌堆中出来并滑动到它显示所有庄家牌的地方。 我的方法工作正常,除了一个问题,我将详细说明: 每当 Y 坐标首先到达目标 Y 坐标
我正在构建一个 UI 库。 有没有人用 framer-motion 和 storybook? 在storybook中运行正常,但是在构建环境中出现错误。 有些人建议降级,但它对我不起作用。 有没有人遇
我需要一些帮助来编写一个功能 block ,我可以用它来记录轴的行程距离。这应该记录每次轴移动有点像里程表,这个值将用于轴的预防性维护。即润滑滚珠丝杠和直线轴承。 该功能必须在轴不移动时忽略轴上的颤振
我正在尝试在 SWIFTUI View 中显示加速度计数据。这段代码可以打印到控制台,但我不明白如何将它放入 View 中,以便我可以在 SWIFTUI 中使用它。 import SwiftUI im
我正在使用运动布局构建一个基于计数器的 android 应用程序。我使用运动布局构建了这个场景,您可以在其中滑动珠子,它会将 +1 添加到计数器。在滑动时将珠子从一个地方移动到另一个地方的初始场景效果
我正在尝试访问 Apple Watch 的陀螺仪。从我读到的内容可以在 watchos 3 中找到。不幸的是,我无法让它工作。它不断返回“陀螺仪不可用”,因此motionManager.isGyroA
所以,我试图让两台计算机同时从跳跃运动中获取数据。 (使用 JavaScript API) 理想情况下,第一个会模仿第二个,在两个屏幕上显示被操纵的手 Leap.loop({host:a
简短的问题:即使设备放在 table 上,CoreMotion 值的加速也会产生相当大的漂移。没问题还是我做错了什么? 长问题:我正在使用 CoreMotion 加速度计,在 -init 方法中: m
我目前正在研究增强现实,为此我想使用陀螺仪和 Core Motion。我研究过 Apple pARk示例代码,我理解大部分数学 我花时间阅读文档,因为乍一看还不清楚!一切都很好,直到我尝试让它在横向模
我正在分析我手头问题的一些解决方案:我从设备接收图像,我需要用它制作视频文件。然而,图像到达时它们之间有一些随机延迟,我正在寻找对其进行编码的最佳方式。我必须逐帧创建此视频,并且在每一帧之后我必须有一
我在将局部欧拉角转换为另一个引用系的角度时遇到了数学问题。假设我们有一部与车辆轴线对齐的 iPhone,我想测量侧倾角,那么 iPhone 的侧倾角等于设备的侧倾角。但是如果 iPhone 是倾斜安装
我是一名优秀的程序员,十分优秀!