Menu toggle
latest: v2.6.4 GitHub

CameraView offers a simple yet powerful framework for watermarks and overlays of any kind. These overlays can be shown on the live camera preview, plus they appear on the media results taken with takePictureSnapshot() or takeVideoSnapshot().

Simple Usage

    <!-- Watermark in bottom/end corner -->
    <!-- More overlays here... -->

As you can see, the overlay system is View-based - each overlay is just a real View attached into the hierarchy. This is a powerful and creative tool. You can, for instance, retrieve the overlay with findViewById and:

  • Animate it!
  • Change its visibility
  • Change its position or appearance
  • Do so while video is being recorded

Any changes in the overlay appearance will be recorded in real-time in the picture snapshot or video snapshot that you are capturing.

As you can see in the example, you can also selectively choose, for each overlay, whether it will draw on the preview (layout_drawOnPreview), on picture snapshots (layout_drawOnPictureSnapshot), on video snapshots (layout_drawOnVideoSnapshot).

Advanced Usage

To add an overlay at runtime, simply use addView(), but make sure you pass in an instance of OverlayLayout.LayoutParams:

OverlayLayout.LayoutParams() params = new OverlayLayout.LayoutParams();
cameraView.addView(overlay, params);

To remove an overlay at runtime, simply use removeView():


To change the layout_ flags at runtime, you should cast the overlay LayoutParams as follows:

// Cast to OverlayLayout.LayoutParams
View overlay = findViewById(;
OverlayLayout.LayoutParams params = (OverlayLayout.LayoutParams) overlay.getLayoutParams();

// Perform changes
params.drawOnPreview = true; // draw on preview
params.drawOnPreview = false; // do not draw on preview
params.drawOnPictureSnapshot = true; // draw on picture snapshots
params.drawOnPictureSnapshot = false; // do not draw on picture snapshots
params.drawOnVideoSnapshot = true; // draw on video snapshots
params.drawOnVideoSnapshot = false; // do not draw on video snapshots

// When done, apply