addViewAnnotation

abstract fun addViewAnnotation(@LayoutRes resId: Int, options: ViewAnnotationOptions): View

Add view annotation inflated from resId synchronously.

Annotation options must include Geometry where we want to bind our view annotation.

Width and height could be specified explicitly but better idea will be not specifying them as they will be calculated automatically based on view layout.

Return

inflated View.

Parameters

resId

layout resource id

options

view annotation options

Throws

if options did not include geometry.

abstract fun addViewAnnotation(@LayoutRes resId: Int, options: ViewAnnotationOptions, asyncInflater: AsyncLayoutInflater, asyncInflateCallback: (View) -> Unit)

Add view annotation inflated from resId asynchronously.

In order to use this function please add following dependency to your project.

Annotation options must include Geometry where we want to bind our view annotation.

Width and height could be specified explicitly but better idea will be not specifying them as they will be calculated automatically based on view layout.

Parameters

resId

layout resource id

options

view annotation options

asyncInflater

instance of AsyncLayoutInflater provided by the user

asyncInflateCallback

callback triggered when View is inflated.

Throws

if options did not include geometry.

abstract fun addViewAnnotation(view: View, options: ViewAnnotationOptions)

Add annotation View which is already inflated. View dimensions will be taken as width / height from view's layout params unless they are not specified explicitly with ViewAnnotationOptions.Builder.width and ViewAnnotationOptions.Builder.height.

Annotation options must include Geometry where we want to bind our view annotation.

Width and height could be specified explicitly but better idea will be not specifying them as they will be calculated automatically based on view layout.

Parameters

view

view that was already inflated

options

view annotation options

Throws

if options did not include geometry.