ScrollView 内的 Android::VideoView
我有一个位于滚动视图内的视频视图。当我滚动滚动视图时,视频视图不会随之滚动。就好像它的位置是固定的一样。如何随着滚动视图中所有其他元素的滚动而正确滚动视频视图?
I have a VideoView that is inside a scrollView. When I scroll the scrollView, the VideoView does not scroll with it. It is like its position is fixed. How can I scroll the VideoView correctly with the scrolling of all other elements in the scrollView?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
显示通常分为两个管道
现在,当您声明表面视图时,您会在 UI 中占用一些屏幕空间,表示这是视频将显示的位置。因此所有其他 UI 元素将无法占用该空间。
当滚动发生时,您的表面视图确实会根据滚动事件向上或向下移动,但问题是视频缓冲区管道不关心帧缓冲区管道中发生的情况,它会继续将视频数据填充到它所在的空间中被初始化为.
所以到目前为止你还不能在android中滚动视频..
The display is usually divided into two pipelines
Now when you declare a surface view you take up some screen space in the UI saying this is where the video will be displayed. So all other UI elements will not be able to occupy that space.
When scrolling happens your surface view will indeed be moved up or down depending on the scroll event but the problem is the video buffer pipeline does not care what happens in the frame buffer pipeline it goes on filling up the video data into the space in which it was initialised with.
So as of now you cannot scroll the video in android..
Romain Guy 在此 Android 问题中说道:
Romain Guy said in this Android issue:
只需放入 VideoView 所在的 android:descendantFocusability="blocksDescendants" ViewGroup 即可。
just put
android:descendantFocusability="blocksDescendants"
ViewGroup that VideoView is in.您可以将视频视图放入布局中,并在其上放置一个空视图。
此代码可以位于您的滚动视图内部。
抱歉我的英语不好,我正在学习;)
You can put the videoview inside of a layout with an empty View over it.
This code can be inside of your scrollview.
Sorry for my English, I'm learning ;)