且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何仅以片段形式打开相机

更新时间:2023-12-05 23:20:22


以下代码打开了摄像头,但覆盖了整个屏幕

Following code opens camera but covers complete screen

可以。您正在启动第三方相机应用程序,这些应用程序通常会占据前台。

Sure. You are launching a third-party camera app, and those usually take over the foreground.


我只想在片段部分打开相机。

I want to open camera ONLY IN FRAGMENT part.

使用 android.hardware.Camera 从头开始编写自己的相机代码和/或 android.hardware.camera2。* 一组类。您无法将第三方相机应用程序启动成片段。

Write your own camera code from scratch, using android.hardware.Camera and/or the android.hardware.camera2.* set of classes. You cannot launch a third-party camera app into a fragment.