AndEngine& SurfaceView(相机预览)
如何添加一个显示相机预览的 SurfaceView 作为 AndEngine 的 BaseGameActivity 的背景(物理示例)。
@Override
public Scene onLoadScene() {
mBackgroundView = new PreviewView(this);
addContentView(mBackgroundView, new LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); // Does not work
addContentView(mBackgroundView.getOverlay(), new LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); // Works. getOverlay() returns an ImageView.
final Scene scene = new Scene(1);
//scene.setBackground(new ColorBackground(0.0f, 0.0f, 0.0f, 0.0f));
How do you add a SurfaceView showing the camera preview as the background of the BaseGameActivity of AndEngine (Physics Example).
@Override
public Scene onLoadScene() {
mBackgroundView = new PreviewView(this);
addContentView(mBackgroundView, new LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); // Does not work
addContentView(mBackgroundView.getOverlay(), new LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); // Works. getOverlay() returns an ImageView.
final Scene scene = new Scene(1);
//scene.setBackground(new ColorBackground(0.0f, 0.0f, 0.0f, 0.0f));
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论