SurfaceView probably does not work like a regular View in this regard.

Instead, do the following:

  1. Put your SurfaceView inside of a FrameLayout or RelativeLayout in your layout XML file, since both of those allow stacking of widgets on the Z-axis
  2. Move your drawing logic into a separate custom View class
  3. Add an instance of the custom View class to the layout XML file as a child of the FrameLayout orRelativeLayout, but have it appear after the SurfaceView

This will cause your custom View class to appear to float above the SurfaceView.

See here for a sample project that layers popup panels above a SurfaceView used for video playback.



Children are drawn in a stack, with the most recently added child on top.

虽然有如上的可以draw overlay的方法,但如果overlay是个GlSurfaceView,问题就来了。请看:,至今无解。



  1. 一篇不错的关于如何使用android camera的文章,
  2. 一个不错的camera usage问题
  3.   这里是draw a GLSurfaceView on CameraPreview的 answer