简体   繁体   English

Android动画相机Surfaceview

[英]Android animated Camera Surfaceview

I got an Surface view with a camera attached to it. 我获得了带有照相机的Surface视图。 The view is in a modal and gets slided up on start of the modal. 该视图处于模态中,并在模态开始时向上滑动。 But only the surface view gets animated and not the image of the camera. 但是,只有表面视图会被激活,而相机的图像则不会。 Is there a way to fix this or is it simply impossible? 有没有办法解决这个问题,或者根本不可能吗?

The SurfaceView has two parts, the Surface and the View. SurfaceView有两个部分,Surface和View。 Generally the View is a transparent window that leaves a "hole" in the View layer, allowing you to see the Surface layer behind it. 通常,“视图”是一个透明窗口,在“视图”层中留下“孔”,使您可以看到其后的“表面”层。 The Camera preview is sent to the Surface. 相机预览将发送到Surface。

I'm not entirely sure what you're describing, but it sounds like you're moving the View without moving the Surface behind it. 我不确定您要描述的内容是什么,但这听起来就像您在移动View而不在其后移动Surface一样。

You can fix that, but even if you do, you will still likely be disappointed, because the View layer and the Surface layer usually move at slightly different times, causing a weird shuddering effect. 您可以解决此问题,但是即使这样做,您仍然可能会感到失望,因为“视图”层和“表面”层的移动时间通常略有不同,从而产生奇怪的抖动效果。 You can't smoothly move both parts of a SurfaceView. 您无法平稳地移动SurfaceView的两个部分。

You would be better off using a TextureView (API 14+), which is actually part of the View layer. 您最好使用TextureView (API 14+),它实际上是View层的一部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM