带有 Exoplayer 的 MotionLayout 处理触摸事件不正确 [英] MotionLayout with Exoplayer handle touch events not properly

查看:36
本文介绍了带有 Exoplayer 的 MotionLayout 处理触摸事件不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Motion Layout 和 ExoPlayer 中有 OnSwipe 动画.但是当 exoplayer 正在播放时,运动布局动画不起作用.我认为 ExoPlayer 拦截触摸事件.我该如何解决这个问题?例如 Youtube 应用程序处理滑动和点击事件

I have OnSwipe animation in Motion Layout and a ExoPlayer. But when exoplayer is playing, motion layout animation not working. I think ExoPlayer intercepting touch events. How can i solve this issue? For example Youtube application handle swipe and also click events

推荐答案

有一个简单的方法扩展 MotionLayout 类并通过覆盖

There is a simple Way of doing that Extends the MotionLayout class and by overriding the

onInterceptTouchEvent()

onInterceptTouchEvent()

 @Override
    public boolean onInterceptTouchEvent(MotionEvent event) {
        if (onTouchEvent(event)) {
            return false;
        } else {
            return true;
        }
    }

这是将 Childs 触摸事件传递给父级或背景布局的最简单方法.这将解决您的问题.

this is a simplest way to pass Childs touch event to parent or to background layout. this will resolve your issue.

这篇关于带有 Exoplayer 的 MotionLayout 处理触摸事件不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆