addViewAnnotation

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

Add view annotation inflated from resId synchronously. Parent layout of resId must have fixed dimensions and should not use ViewGroup.LayoutParams.WRAP_CONTENT.

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

options

view annotation options

resId

layout resource id

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

Add view annotation inflated from resId asynchronously. Parent layout of resId must have fixed dimensions and should not use ViewGroup.LayoutParams.WRAP_CONTENT.

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

asyncInflateCallback

callback triggered when View is inflated.

asyncInflater

instance of AsyncLayoutInflater provided by the user

options

view annotation options

resId

layout resource id

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

options

view annotation options

view

view that was already inflated