AnnotationToolbarComponent is a class that contains the logic and views that make up the annotation toolbar. The annotation toolbar can be customized to contain a number of annotation creation tools button as well as any custom button. With the annotation toolbar, users are able to conveniently create annotations and switch between different tools.
The buttons on the annotation toolbar are contained in two groups: the scrollable region (left) and the sticky region (right). The scrollable region can contain any number of buttons and scrolling is used to access buttons that are off-screen. Buttons in the sticky region will always show on the screen and will not be scrollable.
To learn more about each icon, see the icon cheat sheet .
Create a custom annotation toolbar
The annotation toolbar allows users to easily switch tools when adding annotations to a document. To add an annotation toolbar to your app, first define some layout groups in your app that will contain the annotation toolbar:
If you have used ToolManager to hide certain tools, then the associated tool buttons will also be hidden in the annotation toolbar.
Hide tool buttons
If there are tools that you would like to remove from the annotation toolbar, you can disable them by calling ToolManager.disableToolMode(ToolMode[]). This will also hide the tool in the quick menu. For example:
14 public void onPreItemClick(MenuItem menuItem) {
15 }
16 @Override
17 public void onPostItemClick(MenuItem menuItem) {
18 }
19});
Edit annotations continuously
For continuous annotation creation, AnnotationToolbarComponent will use value set by PdfViewCtrlSettingsManager.setContinuousAnnotationEdit(Context, boolean) (by default true). If continuous annotation editing is disabled, then the tool button will be de-selected in the annotation toolbar after creating an annotation.
Appearance styles
In order to customize the appearance of UI elements in your annotation toolbar, you can define a new style that extends PTAnnotationToolbarTheme inside your res\values\style.xml file and pass it as an attribute to your viewer's theme named pt_annotation_toolbar_style. For more information on customizing the style of UI components, please take a look at our viewer theme guide .