This repository was archived by the owner on Dec 29, 2022. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork1k
[DEPRECATED] Easily integrate Camera features into your Android app
License
NotificationsYou must be signed in to change notification settings
google/cameraview
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
CameraView is deprecated. No more development will be taking place.
UseJetpack CameraX instead.
This is not an official Google product.
CameraView aims to help Android developers easily integrate Camera features.
Requires API Level 9. The library uses Camera 1 API on API Level 9-20 and Camera2 on 21 and above.
API Level | Camera API | Preview View |
---|---|---|
9-13 | Camera1 | SurfaceView |
14-20 | Camera1 | TextureView |
21-23 | Camera2 | TextureView |
24 | Camera2 | SurfaceView |
- Camera preview by placing it in a layout XML (and calling the start method)
- Configuration by attributes
- Aspect ratio (app:aspectRatio)
- Auto-focus (app:autoFocus)
- Flash (app:flash)
<com.google.android.cameraview.CameraViewandroid:id="@+id/camera"android:layout_width="match_parent"android:layout_height="wrap_content"android:keepScreenOn="true"android:adjustViewBounds="true"app:autoFocus="true"app:aspectRatio="4:3"app:facing="back"app:flash="auto"/>
@OverrideprotectedvoidonResume() {super.onResume();mCameraView.start(); }@OverrideprotectedvoidonPause() {mCameraView.stop();super.onPause(); }
You can see a complete usage in the demo app.
SeeCONTRIBUTING.md.