For the complete documentation index, see llms.txt. This page is also available as Markdown.

Customize annotation style editor in Android

The AnnotationStyleDialogFragment can be customized using Android styles or with ToolManagerBuilder, depending on the specific property that needs to be customized.

Customize standard colors in color picker

Standard colors are colors presented in the grid layout of the color picker.

To change these colors, you can override the standard color list as follows:

  1. In the res/values/arrays.xml file of your project, define a string-array containing your custom color list:

  1. In your res/values/styles.xml file, define your own style and inherit PresetColorGridViewStyle, then set your color list custom_standard_colors to the color_list attribute:

  1. Finally, set your customized style CustomPresetColorGridStyle to the preset_colors_style attribute in your application's theme:

To learn more about applying your custom theme to an application, see: Styles and Themes.

Customize the annotation preset styles

An annotation preset style defines a group of annotation style attributes. Presets allow users to conveniently change the annotation's appearance with only one tap. You can override existing annotation presets and define your own in your app.

In this tutorial you will implement custom annotation presets for Text(sticky note) annotations.

  1. In the res/values/styles.xml file of your project, create a series of customized annotation styles. For more detail on annotation style attributes, see tool style attributes.

  1. In the res/values/arrays.xml file of your project, define an array containing your customized presets:

  1. In the application theme, set your custom_presets array to the sticky_note_presets attribute:If you want to change the presets for a different annotation type, refer to the attribute presets table to find the appropriate attribute.

Attribute presets table

Preset attribute
Annotation type
Default presets preview

R.attr.free_text_presets

FreeText

R.attr.freehand_presets

Ink

R.attr.line_presets

Line and Arrow

R.attr.link_presets

Link

R.attr.oval_presets

Circle

R.attr.rect_presets

Square

R.attr.signature_presets

Signature

R.attr.highlight_presets

Highlight

R.attr.squiggly_presets

Squiggly

R.attr.strikeout_presets

StrikeOut

R.attr.underline_presets

Underline

R.attr.sticky_note_presets

Text(sticky note)

R.attr.callout_presets

Callout

R.attr.ruler_presets

Ruler

R.attr.polyline_presets

Polyline

R.attr.polygon_presets

Polygon

R.attr.cloud_presets

Cloud

R.attr.free_highlighter_presets

Free Highlighter

R.attr.widget_presets

Widget

R.attr.other_presets

other annotation types

Customize the icon picker

The icon picker for Text(sticky note) annotations allows users to choose their own icon:

Below is the list of icons available for Text(sticky note) annotations:

Default icons table

Icon name
Icon

Comment

Help

InsertCaret

Star

LightBulb

NewParagraph

CrossMark

CheckMark

LocationPin

ThumbsUp

You can also create your own list by using the icons above:

  1. To change the icon list, first define a string array list in your res/values/arrays.xml file. Each item in the list represents the icon name defined in the table above.

  1. Then, set your custom_icons array to the sticky_note_icons attribute in your application theme:

If you want to add a custom icon to the sticky note icon picker, please refer to [this guide](/android/guides/cookbook/customize-sticky-note-icon) for more details.

Hide properties in the annotation style dialog By default, each annotation type will contain it's own set of annotation style properties. You can hide these defined properties by using `ToolManagerBuilder` as follows:

If the property is not defined for a annotation type (for example font property is not defined for rectangle annotations), setting the CanShow property will not do anything.

Last updated

Was this helpful?