Skip to content

Surface View

Category Requires Version
Layout > Views API 21, Android 5.0 Lollipop 2

Overview

A visible component that shows a live preview of the user''s camera as its background.

Permissions

Events

Clicked

Event to detect clicks on the camera preview.

Face Detected

Event to detect that there are faces in the front of the camera.

Params
numbers Text

Got Preview

Event to get the response from the camera preview as image file. The picture is by default in landscape mode. This event will only work if the option "Save Preview As File" is enabled/ true.

Params
image Text

Long Clicked

Event to detect long clicks on the camera preview.

Picture Created

Event to detect that the user has taken a picture from the preview.

Params
image Text

Preview Paused

Event to detect that the user paused the camera preview.

Preview Stoped

Event to detect that the user stopped the camera preview.

Methods

Pause Preview

Pause the camera preview.

Start Preview

Start the camera preview.

Stop Preview

Stop the camera preview.

Take Picture

Take a picture from the camera preview.

Properties

Align Horizontal

Number Default: 1 ➖ Read Write - Designer Blocks

A number that encodes how contents of the arrangement are aligned horizontally. The choices are: 1 = left aligned, 2 = right aligned, 3 = horizontally centered. Alignment has no effect if the arrangement's width is automatic.

Align Vertical

Number Default: 1 ➖ Write - Designer Blocks

Property for AlignVertical

Clickable

Boolean Default: False ➖ Write - Designer Blocks

Set the surface view component clickable or not clickable.

Detect Faces

Boolean Default: False ➖ Read Write - Designer Blocks

If enabled you can detect how many faces are in the front of the camera.

Flashlight

Boolean ➖ Read Write - Blocks

Turn on or off the device flashlight. The function knows automatic if there is a flash/ torch available.

Height

Number ➖ Read Write - Blocks

Specifies the component's vertical height, measured in pixels.

Height Percent

Number ➖ Write - Blocks

Specifies the component's vertical height as a percentageof the height of its parent Component.

Save Preview As File

Boolean Default: False ➖ Write - Designer Blocks

Enable this block to enable the "Got Preview" event to get a image file from the camera preview.

Use Back Camera

Boolean Default: True ➖ Read Write - Designer Blocks

If enabled you will open the back camera for the camera preview, else you open the front camera. The block detect automatic if there is a device camera available or not.

Visible

Boolean Default: True ➖ Read Write - Designer Blocks

Returns true iff the component is visible.

Width

Number ➖ Read Write - Blocks

Specifies the component's horizontal width, measured in pixels.

Width Percent

Number ➖ Write - Blocks

Specifies the component's horizontal width as a percentageof the Width of its parent Component.


Last update: November 9, 2022