我已经为 Android 创建了自定义相机 View 。我用带有 TextView 和 Button 的半透明 LinearLayout 覆盖了相机预览。现在我需要在 View 中间打一个“洞”,这样你就可以清楚地看到底层的相机预览。然后,该孔充当框架指南,允许用户“框架”照片。
我通过创建 View 并从 View 中剪切出一个矩形来成功使用 iOS 版本,如所演示的那样 here .我将如何为 Android 做同样的事情?
最佳答案
使用SurfaceView .
"the SurfaceView punches a hole in its window to allow its surface to be displayed"
关于包含 'hole' 的 Android View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6189569/