Customizing PDF viewer styling on Android
To customize UI elements, Nutrient uses the standard Android style and theme system(opens in a new tab). When declaring a theme for your application, you can define the primary colors using the attributes colorPrimary, colorSecondary, colorAccent, and colorPrimaryDark. All UI components of Nutrient (toolbars, views, dialogs, etc.) will use these colors to style the rest of the UI.
Out of the box, Nutrient comes with two predefined themes — PSPDFKit.Theme.Default and PSPDFKit.Theme.Dark — for the PdfActivity and all of its views. This guide describes how to tweak the default appearance to match the look of your app.
Defining a custom theme
Since Nutrient adheres to Android’s style and theme framework, you have full control over styling the appearance of all Nutrient components. The PdfActivity is built on top of the Android Compatibility Library v7 and MaterialComponents, which means your theme has to inherit from Theme.MaterialComponents.
Furthermore, since PdfActivity uses a custom toolbar system, the decor action bar of the activity has to be deactivated. The easiest way to do this is to use the default Nutrient themes (PSPDFKit.Theme.Default and PSPDFKit.Theme.Dark) or Theme.MaterialComponents.NoActionBar as a parent theme.
Inside your app’s
styles.xml, create a custom theme withTheme.MaterialComponents.NoActionBaras the parent. Or, to tweak the default style, a custom theme can inherit directly fromPSPDFKit.Theme.DefaultorPSPDFKit.Theme.Darkas a parent:<style name="MyApp.PSPDFKitTheme" parent="PSPDFKit.Theme.Default"><item name="colorPrimary">@color/mymain_color</item><item name="colorPrimaryDark">@color/mymain_color_dark</item><item name="colorSecondary">@color/mymain_color_secondary</item><item name="colorAccent">@color/mymain_color_accent</item><!-- Nutrient comes with several styleable components. --><item name="pspdf__inlineSearchStyle">@style/MyInlineSearch</item></style><style name="MyInlineSearch"><item name="pspdf__textColor">@color/my_inline_search_color</item></style>If you want to use a different parent theme, you can manually disable the default window decor action bar by setting
windowActionBartofalseandwindowNoTitletotrue.Next, set your theme to the
PdfActivityusing theandroid:themeproperty inside yourAndroidManifest.xml:<application><activity android:name="com.pspdfkit.ui.PdfActivity"android:theme="@style/MyApp.PSPDFKitTheme"/></application>
A custom theme can be set either using the manifest or via PdfActivityConfiguration#Builder. In default mode, it can be set via PdfActivityConfiguration.Builder#theme(int), while in night theme mode, it can be set via PdfActivityConfiguration.Builder#themeDark(int). When a custom theme is set using the builder configuration, it overwrites the custom theme set in the manifest.
Nutrient resolves the used style values in the following order, using the first style found:
- Styles provided by the custom theme (i.e. your
MyApp.PSPDFKitThemein the above example) set in the manifest forcom.pspdfkit.ui.PdfActivity. - Default styles/internal Nutrient styles.
This means that Nutrient will use default values for all styles not covered under the current theme’s customization.
Available styles
Nutrient provides a large set of style attributes for both default and dark themes. This allows you to alter the appearance according to your needs. For a comprehensive usage example, have a look at DarkThemeExample and DarkThemeActivity inside the Catalog app.
Navigation history buttons styling
If you want to tweak the default appearance of the chevron icon color inside the navigation history buttons, you can use the pspdf__navigationHistoryIconColor attribute:
<style name="MyApp.Theme" parent="Theme.MaterialComponents.Light.NoActionBar"> <item name="pspdf__navigationHistoryIconColor">@color/dark_icons_blue</item></style>Toolbar styling
You can easily tweak the main toolbar style using the pspdf__mainToolbarStyle attribute of your theme:
<style name="MyApp.Theme" parent="Theme.MaterialComponents.Light.NoActionBar"> <item name="pspdf__mainToolbarStyle">@style/MyApp.MainToolbarStyle</item></style>
<style name="MyApp.MainToolbarStyle"> <item name="pspdf__backgroundColor">?colorPrimary</item> <item name="pspdf__textColor">@color/dark_icons_blue</item>
<item name="pspdf__toolbarTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item> <item name="pspdf__toolbarPopupTheme">@style/ThemeOverlay.AppCompat.Light</item></style>The following attributes can be modified for pspdf__mainToolbarStyle.
| Attribute | Description |
|---|---|
pspdf__backgroundColor | Background color of the main toolbar. This defaults to ?colorPrimary. |
pspdf__textColor | Text color of the main toolbar. This defaults to white. |
pspdf__toolbarTheme | Toolbar theme (set via android:theme on the Toolbar widget). |
pspdf__toolbarPopupTheme | Toolbar popup theme (set via app:popupTheme on the Toolbar widget). |
If you want to fully tweak the default appearance of the main toolbar, use the pspdf__toolbarTheme attribute to override the default theme used by the toolbar. Additionally, you can apply different themes used by toolbar popups with the pspdf__toolbarPopupTheme attribute of your theme.
If you want to tweak the default appearance of the icons inside the PdfActivity’s action bar, you can apply an icon style using the pspdf__actionBarIconsStyle attribute of your theme:
<style name="MyApp.Theme" parent="Theme.MaterialComponents.Light.NoActionBar"> <item name="pspdf__actionBarIconsStyle">@style/MyApp.ActionBarIconsStyle</item></style>
<style name="MyApp.ActionBarIconsStyle"> <item name="pspdf__iconsColor">@color/dark_icons_blue</item> <item name="pspdf__iconsColorActivated">@color/color_dark</item></style>The following attributes can be modified for pspdf__actionBarIconsStyle.
| Attribute | Description |
|---|---|
pspdf__iconsColor | Color of the icons. |
pspdf__iconsColorActivated | Color of the icons when activated. |
pspdf__outlineIcon | Icon for the outline menu option. |
pspdf__outlineIconActivated | Icon for the outline menu option when activated. |
pspdf__searchIcon | Icon for the search menu option. |
pspdf__searchIconActivated | Icon for the search menu option when activated. |
pspdf__gridIcon | Icon for the thumbnail grid menu option. |
pspdf__gridIconActivated | Icon for the thumbnail grid menu option when activated. |
pspdf__aiAssistantIcon | Icon for the AI Assistant menu option. |
pspdf__editAnnotationsIcon | Icon for the editing annotations menu option. |
pspdf__editAnnotationsIconActivated | Icon for the editing annotations menu option when activated. |
pspdf__editContentIcon | Icon for the content editing menu option. |
pspdf__editContentIconActivated | Icon for the content editing menu option when activated. |
pspdf__signatureIcon | Icon for the signature menu option. |
pspdf__signatureIconActivated | Icon for the signature menu option when activated. |
pspdf__shareIcon | Icon for the share menu option. |
pspdf__printIcon | Icon for the print menu option. |
pspdf__settingsIcon | Icon for the settings menu option. |
pspdf__settingsIconActivated | Icon for the settings menu option when activated. |
pspdf__readerViewIcon | Icon for the reader view menu option. |
pspdf__readerViewIconActivated | Icon for the reader view menu option when activated. |
pspdf__infoViewIcon | Icon for the info view menu option. |
pspdf__infoViewIconActivated | Icon for the info view menu option when activated. |
Styling contextual toolbars
Nutrient uses custom contextual toolbars to present annotation editing, annotation creation, text selection, and document editing toolbars. To style contextual toolbars, use the pspdf__contextualToolbarStyle attribute of your theme:
<style name="MyApp.Theme" parent="Theme.MaterialComponents.Light.NoActionBar"> <item name="pspdf__contextualToolbarStyle">@style/MyApp.ContextualToolbarStyle</item></style>
<style name="MyApp.ContextualToolbarStyle"> <item name="pspdf__backgroundColor">?colorPrimaryDark</item> <item name="pspdf__submenuBackgroundColor">?colorPrimary</item> <item name="pspdf__iconsColor">@color/pspdf__color_white</item> <item name="pspdf__iconsColorActivated">@color/pspdf__color_white</item></style>The following attributes can be modified for pspdf__contextualToolbarStyle. Note that some of them only have an effect when the toolbar is not docked at the top of the screen, but rather dragged to float vertically on the left or right side of the page.
| Attribute | Description |
|---|---|
pspdf__backgroundColor | Background color of the contextual toolbars. This defaults to the theme’s ?colorPrimaryDark. |
pspdf__borderColor | Border color of the contextual toolbars.Only used in vertical mode. |
pspdf__submenuBackgroundColor | Background color of the contextual toolbars submenus. This defaults to ?colorPrimary. |
pspdf__submenuBorderColor | Not used in docked mode. Border color of the contextual toolbars submenus.Only used in vertical mode. |
pspdf__iconsColor | Default icons color in the contextual toolbars. This property can be overridden for each contextual toolbar (see below). This defaults to white. |
pspdf__iconsColorActivated | Default color of activated icons in the contextual toolbars. This property can be overridden for each contextual toolbar (see below). This defaults to white. |
Additionally, you can customize each of the toolbars with their own configuration, as shown below.
Annotation creation toolbar
<item name="pspdf__annotationCreationToolbarIconsStyle">@style/MyApp.Theme.AnnotationCreationToolbarIconsStyle</item>| Attribute | Description |
|---|---|
pspdf__iconsColor | Icon color. Overrides pspdf__iconsColor set in pspdf__contextualToolbarStyle. |
pspdf__iconsColorActivated | Activated icon color. Overrides pspdf__iconsColorActivated set in pspdf__contextualToolbarStyle. |
pspdf__highlightIcon | Icon for the highlight annotation menu option. |
pspdf__underlineIcon | Icon for the underline annotation menu option. |
pspdf__strikeoutIcon | Icon for the strikeout annotation menu option. |
pspdf__squigglyIcon | Icon for the squiggly annotation menu option. |
pspdf__noteIcon | Icon for the note annotation menu option. |
pspdf__soundIcon | Icon for the sound annotation menu option. |
pspdf__inkPenIcon | Icon for the ink pen annotation menu option. |
pspdf__inkHighlighterIcon | Icon for the ink highlighter annotation menu option. |
pspdf__magicInkIcon | Icon for the magic ink annotation menu option. |
pspdf__freeTextIcon | Icon for the free text annotation menu option. |
pspdf__freeTextCalloutIcon | Icon for the free text callout annotation menu option. |
pspdf__imageIcon | Icon for the image annotation menu option. |
pspdf__stampIcon | Icon for the stamp annotation menu option. |
pspdf__cameraIcon | Icon for the camera annotation menu option. |
pspdf__signatureIcon | Icon for the signature annotation menu option. |
pspdf__lineIcon | Icon for the line annotation menu option. |
pspdf__lineArrowIcon | Icon for the line with arrow annotation menu option. |
pspdf__squareIcon | Icon for the square annotation menu option. |
pspdf__dashedSquareIcon | Icon for the dashed square annotation menu option. |
pspdf__cloudySquareIcon | Icon for the cloudy square annotation menu option. |
pspdf__circleIcon | Icon for the circle annotation menu option. |
pspdf__dashedCircleIcon | Icon for the dashed circle annotation menu option. |
pspdf__cloudyCircleIcon | Icon for the cloudy circle annotation menu option. |
pspdf__polygonIcon | Icon for the polygon annotation menu option. |
pspdf__dashedPolygonIcon | Icon for the dashed polygon annotation menu option. |
pspdf__cloudyPolygonIcon | Icon for the cloudy polygon annotation menu option. |
pspdf__polylineIcon | Icon for the polyline annotation menu option. |
pspdf__eraserIcon | Icon for the eraser tool menu option. |
pspdf__redactionIcon | Icon for the redaction annotation menu option. |
pspdf__undoIcon | Icon for the undo menu option. |
pspdf__redoIcon | Icon for the redo menu option. |
pspdf__instantCommentIcon | Icon for the instant comment menu option. |
pspdf__measurementDistanceIcon | Icon for the distance measurement tool menu option. |
pspdf__measurementPerimeterIcon | Icon for the perimeter measurement tool menu option. |
pspdf__measurementAreaEllipseIcon | Icon for the ellipse area measurement tool menu option. |
pspdf__measurementAreaPolygonIcon | Icon for the polygon area measurement tool menu option. |
pspdf__measurementAreaRectIcon | Icon for the rectangular area measurement tool menu option. |
pspdf__measurementScaleCalibrationIcon | Icon for the measurement scale calibration menu option. |
pspdf__annotationMultiSelectionIcon | Icon for the annotation multi-selection menu option. |
Annotation editing toolbar
<parameter name="pspdf__annotationEditingToolbarIconsStyle">@style/MyApp.Theme.AnnotationEditingToolbarIconsStyle</item>| Attribute | Description |
|---|---|
pspdf__iconsColor | Icon color. Overrides pspdf__iconsColor set in pspdf__contextualToolbarStyle. |
pspdf__iconsColorActivated | Activated icon color. Overrides pspdf__iconsColorActivated set in pspdf__contextualToolbarStyle. |
pspdf__editIcon | Icon for the edit annotation menu option. |
pspdf__shareIcon | Icon for the share annotation contents menu option. |
pspdf__deleteIcon | Icon for the delete annotation menu option. |
pspdf__annotationNoteIcon | Icon for adding a note to an annotation. |
pspdf__annotationInstantCommentIcon | Icon for adding an instant comment to an annotation. |
pspdf__copyIcon | Icon for copying an annotation. |
pspdf__cutIcon | Icon for cutting an annotation. |
pspdf__undoIcon | Icon for the undo menu option. |
pspdf__redoIcon | Icon for the redo menu option. |
pspdf__playIcon | Icon for playing sound annotations. |
pspdf__recordIcon | Icon for recording sound annotations. |
Text selection toolbar
<item name="pspdf__textSelectionToolbarIconsStyle">@style/MyApp.Theme.TextSelectionToolbarIconsStyle</item>| Attribute | Description |
|---|---|
pspdf__iconsColor | Icon color. Overrides pspdf__iconsColor set in pspdf__contextualToolbarStyle. |
pspdf__iconsColorActivated | Activated icon color. Overrides pspdf__iconsColorActivated set in pspdf__contextualToolbarStyle. |
pspdf__shareIcon | Icon for the share selected text menu option. |
pspdf__copyIcon | Icon for the copy selected text menu option. |
pspdf__speakIcon | Icon for the speak selected text menu option. |
pspdf__highlightIcon | Icon for the highlight selected text menu option. |
pspdf__searchIcon | Icon for the search selected text menu option. |
pspdf__linkIcon | Icon for creating a link from selected text. |
Document editing toolbar
<item name="pspdf__documentEditingToolbarIconsStyle">@style/MyApp.Theme.DocumentEditingToolbarIconsStyle</item>| Attribute | Description |
|---|---|
pspdf__iconsColor | Icon color. Overrides pspdf__iconsColor set in pspdf__contextualToolbarStyle. |
pspdf__iconsColorActivated | Activated icon color. Overrides pspdf__iconsColorActivated set in pspdf__contextualToolbarStyle. |
pspdf__undoIcon | Icon for the undo document editing menu option. |
pspdf__redoIcon | Icon for the redo document editing menu option. |
pspdf__rotatePagesIcon | Icon for the rotate selected pages menu option. |
pspdf__removePagesIcon | Icon for the remove selected pages menu option. |
pspdf__exportPagesIcon | Icon for the export selected pages menu option. |
pspdf__importDocumentIcon | Icon for the import document menu option. |
pspdf__duplicatePagesIcon | Icon for the duplicate selected pages menu option. |
pspdf__moreIcon | Icon for the more options menu. |
pspdf__doneIcon | Icon for the done with document editing menu option. |
Toolbar coordinator layout
The positioning and moving of contextual toolbars is handled by the ToolbarCoordinatorLayout, which can also be themed:
<item name="pspdf__toolbarCoordinatorLayoutStyle">@style/MyApp.Theme.ToolbarCoordinatorLayoutStyle</item>| Attribute | Description |
|---|---|
pspdf__dragTargetColor | Tint the color of available toolbar target locations when dragging the toolbar. This can also be set programmatically using ToolbarCoordinatorLayout#setDragTargetColor. |
Inline search
<item name="pspdf__inlineSearchStyle">@style/MyApp.InlineSearchStyle</item>| Attribute | Description |
|---|---|
pspdf__backgroundColor | Default background color. |
pspdf__borderColor | Default border color. |
pspdf__borderWidth | Default border width. |
pspdf__inputFieldTextAppearance | Input field text appearance. |
pspdf__resultTextAppearance | Text appearance for the result text (that states the current displayed result). |
pspdf__throbberColor | Loading throbber color. |
pspdf__prevIconDrawable | Icon for going to the previous result. |
pspdf__nextIconDrawable | Icon for going to the next result. |
pspdf__prevIconColorTint | Previous icon color. |
pspdf__nextIconColorTint | Next icon color. |
pspdf__backIconColorTint | Back icon color. |
Modular search
<item name="pspdf__modularSearchStyle">@style/MyApp.ModularSearchStyle</item>| Attribute | Description |
|---|---|
pspdf__backgroundColor | Modular search background color. |
pspdf__inputFieldTextColor | Input field text color. |
pspdf__inputFieldHintColor | Input field hint text color. |
pspdf__inputFieldBackgroundColor | Input field background color. |
pspdf__separatorColor | Color of the horizontal line separator below the input field. |
pspdf__listItemBackgroundColor | Background color of the list items. |
pspdf__listItemTitleColor | Text color of the list item title (page number). |
pspdf__listItemSubtitleColor | Text color of the list item subtitle (search snippet). |
pspdf__listItemSelector | Search result list item selector. |
pspdf__highlightBackgroundColor | Highlighted search result background color. |
pspdf__highlightTextColor | Highlighted search result text color. |
Note that pspdf__highlightBackgroundColor is used exclusively for highlighter styling inside the modular search view results list. If you want to change the search result highlighting color when displaying search results in the document view, refer to the highlighter customization section of the text search guide.
Thumbnail bar
<item name="pspdf__thumbnailBarStyle">@style/MyApp.ThumbnailBarStyle</item>| Attribute | Description |
|---|---|
pspdf__backgroundColor | Thumbnail bar background color. |
pspdf__thumbnailWidth | Width of thumbnails in thumbnail bar. |
pspdf__thumbnailHeight | Height of thumbnails in thumbnail bar. |
pspdf__usePageAspectRatio | If this is set to true, thumbnails will not be uniformly sized, but each will have its own aspect ratio. When this is true, the pspdf__thumbnailWidth is ignored and only the pspdf__thumbnailHeight has an effect. |
pspdf__thumbnailBorderColor | Border colors of thumbnails in thumbnail bar. |
Scrollable thumbnail bar
<item name="pspdf__scrollableThumbnailBarStyle">@style/MyApp.ScrollableThumbnailBarStyle</item>| Attribute | Description |
|---|---|
pspdf__backgroundColor | Scrollable thumbnail bar background color. |
pspdf__thumbnailWidth | Width of thumbnails in scrollable thumbnail bar. |
pspdf__thumbnailHeight | Height of thumbnails in scrollable thumbnail bar. |
pspdf__thumbnailBorderColor | Border colors of thumbnails in scrollable thumbnail bar. |
pspdf__thumbnailSelectedBorderColor | Border colors of thumbnails in scrollable thumbnail bar when selected. |
Thumbnail grid
<item name="pspdf__thumbnailGridStyle">@style/MyApp.ThumbnailGridStyle</item>| Attribute | Description |
|---|---|
pspdf__backgroundColor | Thumbnail grid background color. |
pspdf__itemLaberlTextStyle | Default style for the item label text. |
pspdf__itemLabelBackground | Default background for the item label. |
pspdf__selectionCheckBackgroundColor | Default background for the selected item icon. |
pspdf_fabIconColor | Default icon color for the edit document FAB. |
pspdf__itemRippleBackgroundColor | Default ripple background color for item selection. |
pspdf__itemSelectedBorderColor | Border color for selected items. |
Outline view
<item name="pspdf__outlineViewStyle">@style/MyApp.OutlineStyle</item>| Attribute | Description |
|---|---|
pspdf__backgroundColor | Outline view background color. |
pspdf__listItemSelector | Outline view list selector. |
pspdf__defaultTextColor | Default text color (if not specified by the document). |
pspdf__width | Width of the outline view. |
pspdf__bookmarksBarBackgroundColor | Background color of the bookmark bar. |
pspdf__bookmarksBarIconColor | Color for icons on the bookmark bar. |
pspdf__bookmarksCurrentPageColor | Color for the current page indicator in bookmarks. |
pspdf__bookmarksAddIcon | Default icon for the add option. |
pspdf__bookmarksEditIcon | Default icon for the edit option. |
pspdf__bookmarksDoneIcon | Default icon for the done option. |
pspdf__bookmarksDeleteIcon | Default icon for the delete option. |
pspdf__bookmarksDeleteIconColor | Icon color for the delete option. |
pspdf__bookmarksDeleteBackgroundColor | Background icon color for the delete option. |
pspdf__bookmarksGroupIndicatorIconColor | Color for the bookmark group indicator icon. |
pspdf__bookmarksDragHandleIcon | Default icon for the bookmark drag handle. |
pspdf__bookmarksDragHandleIconColor | Icon color for the bookmark drag handle. |
pspdf__annotationsBarBackgroundColor | Background color of the annotations bar. |
pspdf__annotationsBarIconColor | Color for icons on the annotations bar. |
pspdf__annotationsDeleteIcon | Default icon for the delete option. |
pspdf__annotationsDeleteIconColor | Icon color for the delete option on list items. |
pspdf__annotationsEditIcon | Default icon for the edit option. |
pspdf__annotationsDoneIcon | Default icon for the done option. |
pspdf__annotationsDragHandleIcon | Default icon for the annotation drag handle. |
pspdf__annotationsDragHandleIconColor | Icon color for the annotation drag handle. |
pspdf__outlineViewLabelFont | Font resource for outline view labels. |
pspdf__outlineViewTitleFont | Font resource for outline view titles. |
pspdf__outlineViewBodyFont | Font resource for outline view body text. |
pspdf__navigationTabOutlineIcon | Icon for the outline navigation tab. |
pspdf__navigationTabBookmarksIcon | Icon for the bookmarks navigation tab. |
pspdf__navigationTabAnnotationsIcon | Icon for the annotations navigation tab. |
pspdf__navigationTabDocumentInfoIcon | Icon for the document info navigation tab. |
pspdf__navigationTabEmbeddedFilesIcon | Icon for the embedded files navigation tab. |
pspdf__navigationTabIconsColor | Color for navigation tab icons. |
pspdf__navigationTabIconsColorSelected | Color for selected navigation tab icons. |
pspdf__navigationTabBackgroundColor | Background color for navigation tabs. |
pspdf__documentInfoGroupTitleTextColor | Text color for document info group titles. |
pspdf__documentInfoItemTitleTextColor | Text color for document info item titles. |
pspdf__documentInfoItemValueTextColor | Text color for document info item values. |
pspdf__documentInfoItemValueHintTextColor | Hint text color for document info item values. |
pspdf__documentInfoGroupIconColor | Icon color for document info groups. |
pspdf__documentInfoContentIcon | Icon for document content information. |
pspdf__documentInfoChangesIcon | Icon for document changes information. |
pspdf__documentInfoSizeIcon | Icon for document size information. |
pspdf__documentInfoFabBackgroundColor | Background color for document info FAB. |
pspdf__documentInfoFabIconColor | Icon color for document info FAB. |
pspdf__documentInfoFabEditIcon | Edit icon for document info FAB. |
pspdf__documentInfoFabDoneIcon | Done icon for document info FAB. |
Document
<item name="pspdf__documentViewStyle">@style/MyApp.DocumentViewStyle</item>| Attribute | Description |
|---|---|
android:scrollbarStyle | Default scrollbar style and position. |
android:scrollbars | Define which scrollbars (if any) should be displayed while scrolling. |
android:scrollbarSize | Width of vertical scrollbars and height of horizontal scrollbars. |
Annotations
Use this to style the appearance of PDF annotations:
<item name="pspdf__annotationStyle">@style/MyApp.AnnotationStyle</item>| Attribute | Description |
|---|---|
pspdf__linkAnnotationBackgroundColor | Normal background color of link annotations. |
pspdf__linkAnnotationBorderColor | Normal border color of link annotations. |
pspdf__linkAnnotationHighlightBackgroundColor | Background color of highlighted (i.e. touched) link annotations. |
pspdf__linkAnnotationHighlightBorderColor | Border color of highlighted (i.e. touched) link annotations. |
Annotation hints
Use this to style the appearance of PDF annotation hints:
<item name="pspdf__annotationNoteHinterStyle">@style/MyApp.AnnotationHintsStyle</item>| Attribute | Description |
|---|---|
pspdf__noteHinterWidth | Note hinter drawable width (in dp). |
pspdf__noteHinterHeight | Note hinter drawable height (in dp). |
pspdf__noteHinterColor | Tint color to use on note hinter drawable. |
pspdf__noteHinterAlpha | Alpha of the hint icon. Has to be in the range 0 to 255. |
pspdf__noteHinterIcon | Note hinter drawable resource for note annotations. |
pspdf__noteHinterInstantCommentIcon | Note hinter drawable resource for instant comment annotations. |
pspdf__noteHinterTextMarkupLeftPadding | Padding between text markup annotations and the note hint icon in dp. |
pspdf__useNoteHinterIntrinsicSize | Boolean that specifies whether or not to use intrinsic size. |
Search result highlighter
This defines styling for the search result highlighter:
<item name="pspdf__searchResultHighlighterStyle">@style/MyApp.SearchResultHighlighterStyle</item>| Attribute | Description |
|---|---|
pspdf__searchResultBackgroundColor | Search result highlighter background color. |
pspdf__searchResultBorderColor | Search result highlighter border color. |
pspdf__searchResultBorderWidth | Search result highlighter border width (in dp). |
pspdf__searchResultPadding | Search result highlighter padding (in dp). |
pspdf__searchResultAnnotationPadding | Search result highlighter padding (in dp) when the annotation is highlighted. |
pspdf__searchResultAnimationPadding | Search result highlighter padding (in dp) when animated (the highlighter will size up to the desired padding and then come back). |
pspdf__searchResultCornerRadiusToHeightRatio | Float that specifies the search result highlighter corner radius to height ratio. The default is 0.1, meaning the highlight area with a height of 20dp will have 2dp corner radii. |
pspdf__searchResultCornerRadiusMin | Minimum allowed corner radius (in dp) for the search result highlighter. |
pspdf__searchResultCornerRadiusMax | Maximum allowed corner radius (in dp) for the search result highlighter. |
Link annotation highlighter
This defines styling for the link annotations highlighter:
<item name="pspdf__linkAnnotationHighlighterStyle">@style/MyApp.LinkAnnotationHighlighterStyle</item>| Attribute | Description |
|---|---|
pspdf__highlightedBackgroundColor | Link annotation highlighter background color. |
pspdf__highlightedBorderColor | Link annotation highlighter border color. |
pspdf__highlightedBorderWidth | Link annotation highlighter border width (in dp). |
pspdf__highlightedLinkAnnotationPadding | Link annotation highlighter padding (in dp). |
pspdf__highlightedLinkAnnotationAnimationPadding | Link annotation highlighter padding (in dp) when animated (the highlighter will size up to the desired padding and then come back). |
pspdf__highlightedRectangleCornerRadiusToHeightRatio | Float that specifies the link annotation highlighter corner radius to height ratio. The default is 0.1, meaning the highlight area with a height of 20dp will have 2dp corner radii. |
pspdf__highlightedRectangleMinCornerRadius | Minimum allowed corner radius (in dp) for the link annotation highlighter. |
pspdf__highlightedRectangleMaxCornerRadius | Maximum allowed corner radius (in dp) for the link annotation highlighter. |
Text selection
<item name="pspdf__textSelectionStyle">@style/MyApp.TextSelectionStyle</item>| Attribute | Description |
|---|---|
pspdf__highlightColor | Text selection highlight (background) color. |
pspdf__leftHandleColor | Text selection left handle color. |
pspdf__rightHandleColor | Text selection right handle color. |
Password view
<item name="pspdf__passwordViewStyle">@style/MyApp.PasswordViewStyle</item>| Attribute | Description |
|---|---|
pspdf__color | Password text input area color. |
pspdf__hintColor | Password text input area hint text color. |
pspdf__floatingHintColor | Password text input area hint text color (when hint moves above the input area). |
pspdf__errorColor | Password text input area error text color. |
pspdf__icon | Password text input area icon. |
pspdf__iconTintingEnabled | Password text input area icon tint. |
Signature layout
<item name="pspdf__passwordViewStyle">@style/MyApp.SignatureLayoutStyle</item>| Attribute | Description |
|---|---|
pspdf__addSignatureIcon | Icon for the add signature action. |
pspdf__addSignatureIconColor | Icon color for the add signature action. |
pspdf__addSignatureIconBackgroundColor | Icon background color for the add signature action. |
pspdf__selectImageTextColor | Text color for “Select Image” text below add signature FAB. |
pspdf__replaceImageTextColor | Text color for “Replace Image” text below selected image. |
pspdf__clearSignatureTextColor | Text color for “Clear Signature” text below signature. |
pspdf__signHereTextColor | Text color for “Sign Here” text below signature canvas. |
pspdf__acceptSignatureIcon | Icon for the accept signature action. |
pspdf__acceptSignatureIconColor | Icon color for the accept signature action. |
pspdf__acceptSignatureIconBackgroundColor | Icon background color for the accept signature action. |
pspdf__deleteSelectedSignaturesIcon | Icon for the delete selected signatures action. |
pspdf__deleteSelectedSignaturesIconColor | Icon color for the delete selected signatures action. |
pspdf__deleteSelectedSignaturesIconBackgroundColor | Icon background color for the delete selected signatures action. |
pspdf__clearSignatureCanvasIcon | Icon for the clear signature canvas action. |
pspdf__clearSignatureCanvasIconColor | Icon color for the clear signature canvas action. |
pspdf__clearSignatureCanvasIconBackgroundColor | Icon background color for the clear signature canvas action. |
pspdf__signatureInkColorPrimary | Primary signature ink color. |
pspdf__signatureInkColorSecondary | Secondary signature ink color. |
pspdf__signatureInkColorTertiary | Tertiary signature ink color. |
pspdf__backgroundColor | Signature layout background color. |
pspdf__textColor | Signature layout text color. |
pspdf__signerListSelectedItemBackground | Signer list selected item background color. |
pspdf__signerListSelectedItemForeground | Signer list selected item foreground color. |
pspdf__signatureListSelectedItemBackground | Signature list selected item background color. |
pspdf__signatureListItemBackground | Signature list item background color. |
pspdf__selectedTabIndicatorColor | Selected tab indicator color. |
pspdf__typeSignatureFontColor | Font color for typed electronic signatures. |
pspdf__fontSelectionVisible | Whether font selection spinner is visible (boolean). |
pspdf__circleButtonBorderColor | Color of FAB button circle border. |
Property inspector
<item name="pspdf__propertyInspectorStyle">@style/MyApp.PropertyInspectorStyle</item>| Attribute | Description |
|---|---|
pspdf__minHeight | Minimum height of property inspector (in dp). |
pspdf__maxHeight | Maximum height of property inspector (in dp). |
pspdf__maxWidth | Maximum width of property inspector (in dp). |
pspdf__backgroundColor | Property inspector background color. |
pspdf__textColor | Property inspector text color. |
pspdf__itemHeight | Property inspector item height (in dp). |
pspdf__searchVisible | Whether or not the search bar will be added to the property inspector. |
pspdf__dividerMargin | Top and bottom margin value for horizontal line divider. |
pspdf__errorColor | Color for errors in the inspector. |
pspdf__progressBackgroundTint | Background tint for progress indicators. |
pspdf__buttonIconTint | Icon color for property action buttons (like zIndex buttons). |
pspdf__modalDialogStyle | Property inspector modal dialog style (see below). |
The modal dialog style is set inside the previously mentioned pspdf__propertyInspectorStyle via:
<item name="pspdf__modalDialogStyle">@style/MyApp.ModalDialog.PropertyInspector</item>| Attribute | Description |
|---|---|
pspdf__titleBackground | Property inspector modal dialog title background color. |
pspdf__titleTextColor | Property inspector modal dialog title text color. |
pspdf__titleIconsColor | Property inspector modal dialog title icons color. |
pspdf__titleHeight | Property inspector modal dialog title height (in dp). |
pspdf__titleTextSize | Property inspector modal dialog title text size (in sp). |
pspdf__titlePadding | Property inspector modal dialog title padding (in dp). |
pspdf__cornerRadius | Property inspector modal dialog corner radius (in dp). |
Action menu
This is used for styling the bottom action menu (pops up when sharing a document, for example):
<item name="pspdf__actionMenuStyle">@style/MyApp.ActionMenuStyle</item>| Attribute | Description |
|---|---|
pspdf__maxWidth | Action menu bar maximum width (in dp). |
pspdf__backgroundColor | Action menu background color. |
pspdf__labelColor | Action menu label color. |
pspdf__fixedActionsPanelBackgroundColor | Background color of the fixed actions panel. |
pspdf__fixedActionsIconColor | Icons color in the fixed actions panel. |
pspdf__fixedActionsIconBackground | Icons background color in the fixed actions panel. |
Stamp picker
<item name="pspdf__stampPickerStyle">@style/MyApp.StampPickerStyle</item>| Attribute | Description |
|---|---|
pspdf__maxHeight | Stamp picker maximum height (in dp). |
pspdf__maxWidth | Stamp picker maximum width (in dp). |
pspdf__backgroundColor | Stamp picker background color. |
pspdf__stamp_grid_backgroundColor | Background color for the stamp selection grid. |
pspdf__textColor | Stamp picker text color. |
pspdf__hintColor | Stamp picker hint color. |
pspdf__acceptCustomStampIcon | Icon for the accept stamp button. |
pspdf__acceptCustomStampIconColor | Icon color for the accept stamp button. |
pspdf__acceptCustomStampIconBackgroundColor | Icon background color for the accept stamp button. |
Sharing dialog
<item name="pspdf__sharingDialogStyle">@style/MyApp.SharingDialogStyle</item>| Attribute | Description |
|---|---|
pspdf__backgroundColor | Sharing dialog background color. |
pspdf__errorColor | Sharing dialog error color. |
New page dialog
<item name="pspdf__newPageDialogStyle">@style/MyApp.NewPageDialogStyle</item>| Attribute | Description |
|---|---|
pspdf__backgroundColor | New page dialog background color. |
Settings dialog
This is used for styling the settings dialog that displays page layout and scroll direction options:
<item name="pspdf__settingsDialogStyle">@style/MyApp.SettingsDialogStyle</item>| Attribute | Description |
|---|---|
pspdf__settings_preset_animation_url_horizontal | Animation URL for horizontal scroll direction preset. |
pspdf__settings_preset_animation_url_vertical | Animation URL for vertical scroll direction preset. |
pspdf__settings_preset_still_image_horizontal | Still image for horizontal scroll direction preset. |
pspdf__settings_preset_still_image_vertical | Still image for vertical scroll direction preset. |
pspdf__settings_preset_unselected_border_color | Border color for unselected preset items. |
pspdf__settings_preset_label_textcolor | Text color for preset item labels. |
pspdf__settings_preset_selected_border_width | Border width for selected preset items. |
pspdf__settings_preset_unselected_border_width | Border width for unselected preset items. |
pspdf__settings_section_title_textcolor | Text color for section titles. |
pspdf__settings_section_label_textcolor | Text color for section labels. |
pspdf__settings_divider_color | Color of divider lines between settings sections. |
pspdf__settings_selected_color | Color for selected settings items. |
pspdf__settings_unselected_color | Color for unselected settings items. |
Settings mode picker items
This is used for styling settings mode picker items:
<item name="pspdf__settingsModePickerItemStyle">@style/MyApp.SettingsModePickerItemStyle</item>| Attribute | Description |
|---|---|
pspdf__itemTint | Item tint for each of the settings mode picker items (use the selector to specify tint color for various item states). |
AI Assistant dialog
This is used for styling the AI Assistant chat dialog:
<item name="pspdf__aiAssistantDialogStyle">@style/MyApp.AIAssistantDialogStyle</item>| Attribute | Description |
|---|---|
pspdf__aiassistant_textcolor | Text color for the AI Assistant dialog. |
pspdf__aiassistant_background | Background color for the AI Assistant dialog. |
pspdf__aiassistant_chatBackground | Background color for the chat area. |
pspdf__aiassistant_mineChatBackground | Background color for user’s chat messages. |
pspdf__aiassistant_mineChatTextColor | Text color for user’s chat messages. |
pspdf__aiassistant_innerChatBackground | Background color for AI response messages. |
pspdf__aiassistant_innerChatTextColor | Text color for AI response messages. |
pspdf__aiassistant_textFieldBackgroundColor | Background color for the text input field. |
pspdf__aiassistant_textFieldTextColor | Text color for the text input field. |
pspdf__aiassistant_textFieldHintColor | Hint text color for the text input field. |
pspdf__aiassistant_retryButtonBackgroundColor | Background color for the retry button. |
pspdf__aiassistant_submitButtonEnabledColor | Color for the submit button when enabled. |
Document view
This accepts a style defining View attributes for modifying the appearance of scrollbars:
<item name="pspdf__documentViewStyle">@style/MyApp.DocumentViewStyle</item>| Attribute | Description |
|---|---|
android:scrollbarStyle | The style of the document view scrollbar. |
android:scrollbars | Enabled document view scrollbars (horizontal or vertical). |
android:scrollbarSize | Document view scrollbar size (in dp). |
Form selection
<item name="pspdf__formSelectionStyle">@style/MyApp.FormSelectionStyle</item>| Attribute | Description |
|---|---|
pspdf__highlightColor | Form selection highlight color. |
pspdf__itemHighlightColor | Highlight color for selected items in lists and combo boxes. |
pspdf__requiredTextElementBorderColor | Form selection border color for required text elements. |
pspdf__selectedTextElementBackgroundColor | Form selection background color for selected text elements. |
pspdf__selectedTextElementBorderColor | Form selection border color for selected text elements. |
pspdf__touchedFormElementHighlightColor | Form selection highlight color for touched elements. |
pspdf__signHereOverlayBackgroundColor | Background color for the sign here overlay. |
pspdf__suggestionListBackgroundColor | Background color for the suggestion list. |
pspdf__suggestionListTextColor | Text color for the suggestion list. |
Form editing bar
<item name="pspdf__formEditingBarStyle">@style/MyApp.FormEditingBarStyle</item>| Attribute | Description |
|---|---|
pspdf__backgroundColor | Form editing bar background color. |
pspdf__textColor | Form editing bar text color. |
pspdf__iconsColor | Form editing bar icons color. |
pspdf__prevIconDrawable | Form editing bar previous element icon resource. |
pspdf__nextIconDrawable | Form editing bar next element icon resource. |
pspdf__validationErrorBackgroundColor | Form editing bar validation error background color. |
pspdf__validationErrorTextColor | Form editing bar validation error text color. |
Popup toolbar
This is used for styling popup toolbars (e.g. when text is selected or when pasting elements):
<item name="pspdf__popupToolbarStyle">@style/MyApp.PopupToolbarStyle</item>| Attribute | Description |
|---|---|
pspdf__backgroundColor | Popup toolbar background color. |
pspdf__itemTint | Popup toolbar item tint. |
pspdf__itemTintDisabled | Popup toolbar item tint when item is disabled. |
Content editing
This is used for styling content editing features:
<item name="pspdf__contentEditingStyle">@style/MyApp.ContentEditingStyle</item>| Attribute | Description |
|---|---|
pspdf__textBlockFrameColor | Frame color for text blocks in normal mode. |
pspdf__textBlockFrameColorInvertedMode | Frame color for text blocks in inverted (dark) mode. |
pspdf__editedTextBlockFrameColor | Frame color for text blocks being edited in normal mode. |
pspdf__editedTextBlockFrameColorInvertedMode | Frame color for text blocks being edited in inverted mode. |
Content editing toolbar
This is used for styling the content editing toolbar:
<item name="pspdf__contentEditingToolbarStyle">@style/MyApp.ContentEditingToolbarStyle</item>| Attribute | Description |
|---|---|
pspdf__contentEditingToolbarIconColorInactive | Icon color for inactive content editing toolbar items. |
pspdf__contentEditingToolbarIconColorActivated | Icon color for activated content editing toolbar items. |
pspdf__contentEditingToolbarTextIconColor | Text icon color for content editing toolbar. |
Content editing styling bar
This is used for styling the content editing styling bar that appears when editing text:
<item name="pspdf__contentEditingStylingBarStyle">@style/MyApp.ContentEditingStylingBarStyle</item>| Attribute | Description |
|---|---|
pspdf__backgroundColor | Background color of the styling bar. |
pspdf__textColor | Text color in the styling bar. |
pspdf__iconsColor | Border color of styling bar icons. |
pspdf__iconBorderColor | Fill color of color icon. |
pspdf__fontButtonsTintColor | Tint color for button backgrounds. |
pspdf__fontButtonsTintColorChecked | Tint color for checked button backgrounds. |
pspdf__fontSmallButtonsTintColor | Tint color for small buttons (e.g. +/- buttons). |
pspdf__borderColor | Border color at the top of the styling bar. |
Sound annotation icon
This is used for styling sound annotation icons:
<item name="pspdf__soundAnnotationIconStyle">@style/MyApp.SoundAnnotationIconStyle</item>| Attribute | Description |
|---|---|
pspdf__backgroundColor | Icon circle background color. |
pspdf__iconColor | Color of the sound icon. |
pspdf__playbackColor | Color of the ring indicator when playback is active. |
pspdf__recordColor | Color of the ring indicator when recording is active. |
pspdf__selectionColor | Color of the ring indicator when sound annotation is selected. |
Audio inspector
This is used for styling the audio inspector bar:
<item name="pspdf__audioInspectorStyle">@style/MyApp.AudioInspectorStyle</item>| Attribute | Description |
|---|---|
pspdf__backgroundColor | Background color of the audio inspector. |
pspdf__iconsColor | Tint color for icons. |
pspdf__recordingIconColor | Tint color for the recording icon. |
Note editor view
This is used for styling the note editor view:
<item name="pspdf__noteEditorStyle">@style/MyApp.NoteEditorStyle</item>| Attribute | Description |
|---|---|
pspdf__noteBackgroundColor | Background color of notes. |
pspdf__notePrimaryTextColor | Primary text color in notes. |
pspdf__noteSecondaryTextColor | Secondary text color in notes. |
pspdf__commentColor | Color for comments in notes. |
Eraser tool
This is used for styling the annotation eraser tool:
<item name="pspdf__eraserStyle">@style/MyApp.EraserStyle</item>| Attribute | Description |
|---|---|
pspdf__eraserOutlineColor | Color of the circle drawn to highlight the eraser tool. |
Stepper view
This is used for styling stepper views (multistep progress indicators) in the document comparison UI:
<item name="pspdf__stepperViewStyle">@style/MyApp.StepperViewStyle</item>| Attribute | Description |
|---|---|
pspdf__selectedStepColor | Color of selected step indicator. |
pspdf__selectedTextColor | Text color for selected step. |
pspdf__unselectedTextColor | Text color for unselected steps. |
pspdf__unselectedStepColor | Color of unselected step indicator. |
pspdf__selectedDividerColor | Color of divider line for selected step. |
pspdf__unselectedDividerColor | Color of divider line for unselected steps. |
pspdf__labelTextColor | Text color for step labels. |
pspdf__stepNumberTextSize | Text size for step numbers. |
pspdf__stepLabelTextSize | Text size for step labels. |
pspdf__stepRadius | Radius of step indicator circles. |
pspdf__stepPadding | Padding around steps. |
pspdf__labelTopPadding | Top padding for step labels. |
pspdf__stepNumberPadding | Padding for step numbers. |
pspdf__backgroundColor | Background color of the stepper view. |
Breadcrumbs view
This is used for styling breadcrumb view (showing “old” > “new”) in the document comparison UI:
<item name="pspdf__breadCrumbsViewStyle">@style/MyApp.BreadCrumbsViewStyle</item>| Attribute | Description |
|---|---|
pspdf__titleColor | Color for breadcrumb titles. |
pspdf__selectedTitleColor | Color for selected breadcrumb title. |
pspdf__dividerColor | Color for dividers between breadcrumb items. |
pspdf__textSize | Text size for breadcrumb titles. |
pspdf__backgroundColor | Background color of the breadcrumbs view. |
Helper line
This is used for styling helper lines (snapping guides):
<item name="pspdf__helperLineStyle">@style/MyApp.HelperLineStyle</item>| Attribute | Description |
|---|---|
pspdf__helperLineColor | Color of the helper line snapping guides. |
Tab bar
This is used for styling the tab bar that’s shown when multiple documents are opened:
<item name="pspdf__tabBarStyle">@style/MyApp.TabBarStyle</item>| Attribute | Description |
|---|---|
pspdf__backgroundColor | Tab bar background color. |
pspdf__tabColor | Color of the tab items. |
pspdf__tabIndicatorColor | Color of the indicator of the currently selected tab. |
pspdf__tabTextColor | Color of the text on tab items when not selected. |
pspdf__tabTextColorSelected | Color of the text on tab items when selected. |
pspdf__tabIconColor | Color of the close icon on tab items when not selected. |
pspdf__tabIconColorSelected | Color of the close icon on tab items when selected. |
pspdf__tabBarHeight | The height of the tab bar. |
pspdf__tabBarMinimumWidth | The minimum width of a single tab bar item. |
pspdf__tabBarMaximumWidth | The maximum width of a single tab bar item. |
pspdf__tabBarTextSize | The size of the document title text on a tab item. |
Annotation selection layout
Use this to style the appearance of the annotation selection layout:
<item name="pspdf__annotationSelectionStyle">@style/MyApp.AnnotationSelection</item>| Attribute | Description |
|---|---|
pspdf__borderColor | Border color of the annotation selection layout. |
pspdf__borderWidth | Border width of the annotation selection layout. |
pspdf__scaleHandleColor | Scale handle color of the annotation selection layout (rotation handle included). |
pspdf__editHandleColor | Edit handle color of the annotation selection layout. |
pspdf__padding | Padding of the annotation selection layout. |
pspdf__guideLineWidth | Guide line width of the annotation selection layout. |
pspdf__guideLineColor | Guide line color of the annotation selection layout. |
pspdf__guideLineIncrease | Guide line dimension increase over the annotation selection layout. |
pspdf__topLeftScaleHandleDrawable | Scale handle drawable in the top-left part of the annotation selection layout. |
pspdf__topCenterScaleHandleDrawable | Scale handle drawable in the top-center part of the annotation selection layout. |
pspdf__topRightScaleHandleDrawable | Scale handle drawable in the top-right part of the annotation selection layout. |
pspdf__centerLeftScaleHandleDrawable | Scale handle drawable in the center-left part of the annotation selection layout. |
pspdf__centerRightScaleHandleDrawable | Scale handle drawable in the center-right part of the annotation selection layout. |
pspdf__bottomLeftScaleHandleDrawable | Scale handle drawable in the bottom-left part of the annotation selection layout. |
pspdf__bottomCenterScaleHandleDrawable | Scale handle drawable in the bottom-center part of the annotation selection layout. |
pspdf__bottomRightScaleHandleDrawable | Scale handle drawable in the bottom-right part of the annotation selection layout. |
pspdf__rotationHandleDrawable | Scale handle drawable of the annotation selection layout for the rotation. |
pspdf__backgroundDrawable | Background drawable for the annotation selection layout. |
When a scale handle drawable is set to null and the pspdf__scaleHandleColor is set to Color.TRANSPARENT, the scale handle will not be operational. When a drawable is set for a scale handle together with a color other than transparent, the drawable will take precedence over the color. When a background drawable is set by pspdf__backgroundDrawable together with pspdf__borderColor, the drawable will take precedence over the color.
When setting custom drawables for scale handles, some configurations may produce unwanted results when resizing the annotation selection layout. Make sure to test your custom drawable configuration thoroughly.
Measurement tools
Use the following to style the appearance of the Measurement Tools attributes:
<item name="pspdf__measurementToolsStyle">@style/MyApp.MeasurementTools</item>| Attribute | Description |
|---|---|
pspdf__measurementValuePopupBackgroundColor | Background color for the popup view showing the measured value. |
pspdf__scaleListItemBackgroundColor | Background color for scale list items. |
pspdf__scaleListItemCheckColor | Color for check marks in scale list items. |
pspdf__scaleButtonForegroundColor | Foreground color for the currently selected scale button. |
pspdf__scaleButtonBackgroundColor | Background color for the currently selected scale button. |
Customizing the Android status bar text color
By default, Android automatically chooses the status bar text color (white or black) based on the status bar’s background color. This means it isn’t possible to set a specific foreground color. Instead, you can let the OS know whether it should use a light or dark appearance, and it’ll choose the foreground color based on that.
Setting the status bar text color
You can control whether the status bar text and icons appear light or dark, depending on your app’s design.
For Android 11+ (API 30+)
import androidx.core.view.WindowInsetsControllerCompat
WindowInsetsControllerCompat(window, window.decorView).let { controller -> controller.isAppearanceLightStatusBars = true // Dark icons (light status bar)}For Android 8.0–10 (API 26–29)
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BARChanging the background color
You can also customize the status bar’s background to match your app’s theme or branding:
window.statusBarColor = Color.RED