本文介绍了相机preVIEW UI在Android上叠加?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样写code的布局UI元素(按钮等)在相机preVIEW在Android?

How do I write code which layouts UI elements (Buttons, etc) over camera preview on Android ?

推荐答案

SurfaceView 在一个容器中,让Z轴分层,如 RelativeLayout的的FrameLayout 。把东西出现在 SurfaceView 后来在XML之上 - 父母以后的孩子会画在早期儿童顶部的父

Put the SurfaceView in a container that allows for Z-axis layering, such as RelativeLayout or FrameLayout. Put the things to appear on top of the SurfaceView later in the XML -- later children of a parent will draw over top of earlier children in the parent.

这里是使用 SurfaceView 视频播放演示项目的技术。相同的概念应该憋了 SurfaceView 相机preVIEW。

Here is a project using a SurfaceView for video playback that demonstrates the technique. The same concepts should hold for a SurfaceView for camera preview.

记住额外的工作需要,要由机器人完成的融入你的widget与preVIEW,让您的preVIEW帧速率可能会下降。

Bear in mind that extra work needs to be done by Android to blend your widgets with the preview, so your preview frame rate may drop.

这篇关于相机preVIEW UI在Android上叠加?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 01:00