Some test text!
Android / Guides / Style editor
AnnotStyleDialogFragment
is a DialogFragment
that shows annotation style properties in a bottom sheet view. With this style dialog, users can change the annotation color with the advanced color picker or directly select preset styles. The style dialog also provides a recent and a favorite list for quick access.
The AnnotationStyleDialogFragment.Builder
class allows you to create an AnnotStyleDialogFragment
with a specified AnnotStyle
. The AnnotStyle
represents the initial annotation style to display.
Example
// 1. Instantiate an AnnotStyle with its constructor
AnnotStyle annotStyle = new AnnotStyle();
// 2. Set annotation type to annot style
annotStyle.setAnnotType(Annot.e_Square);
// 3. Set blue stroke, yellow fill color, thickness 5, opacity 0.8 to the annotation style.
annotStyle.setStyle(Color.BLUE, Color.YELLOW, 5f, 0.8f);
// 4. Instantiate an AnnotStyleDialogFragment.Builder with its constructor
AnnotStyleDialogFragment.Builder styleDialogBuilder = new AnnotStyleDialogFragment.Builder(annotStyle);
// 5. Set anchor view if you want the `AnnotStyleDialogFragment` be displayed as a popup window in tablet mode
styleDialogBuilder.setAnchorView(myButton);
// 6. Build AnnotStyleDialogFragment with the arguments supplied to this builder.
AnnotStyleDialogFragment annotStyleDialog = styleDialogBuilder.build();
Afterwards, to show an annotation style dialog call show(FragmentManager)
. Similarly, to dismiss the annotation style dialog programmatically call dismiss()
.
You can listen to annotation style changes by setting an OnAnnotStyleChangeListener
to your AnnotStyleDialogFragment
using setOnAnnotStyleChangeListener
.
The AnnotStyleDialogFragment
raises an event when a style change occurs (such as a color change, thickness change, text color change, etc., allowing you to define custom behavior for such events.
Get the answers you need: Chat with us