开发者

android, use camera as a background for an activity

I have a request that background for my activi开发者_StackOverflow中文版ty must be "transparent", ie. background of an activity should be camera's current view. What is the easiest way to implemet this? I have all the activities already implemented, with all the logic already implemented. Ideally, solution wouldn't include a lot of modification of an existing code.


Normally this is done with SurfaceView. Use it via camera.setPreviewDisplay(surfaceView)

To use it in your app, the simplest way would be to use FrameLayout as a top layout of your Activity and then put SurfaceView any you current top layout inside it.

`FrameLayout`
    `SurfaceView`
    `yourExistingLayout`

Of course your existing layout must be transparent to see the underlying SurfaceView. Note also that this alpha blending takes a lot of processor power so it will eat battery.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜