> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/android/ui-customization/custom-theme-a.md).

# Customize the viewer's theme

Customize the viewer's theme by overriding the PDFTronAppTheme xml style in your project. Learn how to style various elements like toolbar, bottom bar, and more for a personalized viewing experience.

## Customize the viewer's theme

The document viewer can be customized by overriding the `PDFTronAppTheme` xml style in your project. For example:

{% tabs %}
{% tab title="XML" %}
{% code lineNumbers="true" %}

```xml
<style name="PDFTronAppTheme" parent="PDFTronAppThemeBase"> <!-- List of required attributes --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> <item name="actionMenuTextColor">@color/app_color_icon</item> <item name="drawerArrowStyle">@style/DrawerArrowStyle</item> <item name="actionModeBackground">?attr/colorPrimary</item> <item name="windowActionModeOverlay">true</item> </style>
```

{% endcode %}
{% endtab %}
{% endtabs %}

Note that the theme name must either exactly match `PDFTronAppTheme` or passed into `ViewerBuilder2.usingTheme(int)` and extend `PDFTronAppTheme` theme. If you cannot extend `PDFTronAppTheme` and is extending an `AppCompat` theme, then you will need to define custom theme attributes for the theme to work properly. Here are the custom attributes:

| Attribute                            | Description                                                                                    |
| ------------------------------------ | ---------------------------------------------------------------------------------------------- |
| `pt_toolbar_theme`                   | Used to style the options menu toolbar. See `ToolbarTheme`.                                    |
| `pt_toolbar_popup_style`             | Used to style the popup menu in the toolbar. See `ToolbarPopupTheme`.                          |
| `pt_toolbar_style`                   | Used to style the options menu toolbar background. See `ToolbarStyle`.                         |
| `quick_menu_item`                    | Used to style the quick menu. See `QuickMenuItem`.                                             |
| `custom_bookmarks_tab_layout`        | Used to style the outline/user bookmark/annotation list dialog. See `BookmarksTabLayoutStyle`. |
| `pt_stamp_tab_layout_style`          | Used to style the stamp dialog tab layout. See `StampTabLayoutStyle`.                          |
| `pt_bottom_bar_style`                | Used to style the bottom navigation bar. See `PTBottomBarTheme`.                               |
| `pt_preset_bar_style`                | Used to style the annotation preset bar. See `PTPresetBarTheme`.                               |
| `pt_annotation_toolbar_style`        | Used to style the annotation toolbar. See `PTAnnotationToolbarTheme`.                          |
| `pt_toolbar_switcher_dialog_style`   | Used to style the toolbar switcher popup dialog. See `PTToolbarSwitcherDialogTheme`.           |
| `pt_toolbar_switcher_button_style`   | Used to style the toolbar switcher menu button. See `PTToolbarSwitcherButtonTheme` .           |
| `pt_toolbar_tab_action_button_style` | Used to style the tab action button. See `TabActionButtonTheme` .                              |
| `pt_document_slider_style`           | Used to style the page slider. See `DocumentSliderStyle`.                                      |
| `pt_pdf_tab_layout_style`            | Used to style the document tabs. See `PdfTabLayoutStyle`.                                      |
| `pt_floating_nav_style`              | Used to style the floating action buttons. See `DefaultFloatingButtonNavStyle`.                |
| `pt_sound_dialog_style`              | Used to style the sound annotation dialog. See `SoundDialogStyle`.                             |
| `pt_page_indicator_style`            | Used to style the page indicator. See `PageIndicatorTheme`.                                    |
| `pt_sticky_note_dialog`              | Used to style the sticky note dialog. See `DialogStickyNote`.                                  |
| `pt_create_signature_dialog_style`   | Used to style the signature creation dialog. See `CreateSignatureDialogTheme`.                 |
| `pt_menu_editor_dialog_style`        | Used to style the toolbar editor dialog. See `MenuEditorDialogTheme`.                          |
| `pt_annot_style_dialog_style`        | Used to style the annotation style dialog. See `AnnotStyleDialogTheme`.                        |
| `pt_annotation_filter_dialog_style`  | Used to style the annotation filter dialog. See `AnnotationFilterDialogTheme`.                 |
| `pt_create_stamp_dialog_style`       | Used to style the stamp creation dialog. See `CreateStampDialogTheme`.                         |
| `pt_add_page_dialog_style`           | Used to style the add page dialog. See `AddPageDialogTheme`.                                   |
| `pt_tab_switcher_dialog_style`       | Used to style the tab switcher dialog. See `TabSwitcherDialogTheme`.                           |
| `pt_outline_dialog_style`            | Used to style the outline dialog. See `OutlineDialogTheme`                                     |

Additionally if you are not using a `NoActionBar` theme AppCompat theme, you will need to add the additional attributes:

{% tabs %}
{% tab title="XML" %}
{% code lineNumbers="true" %}

```xml
<style name="PDFTronAppTheme" parent="Theme.AppCompat.*"> ... <!-- Action bar --> <item name="windowActionModeOverlay">true</item> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> </style>
```

{% endcode %}
{% endtab %}
{% endtabs %}

Note, we highly recommend extend `PDFTronAppTheme` whenever possible.

## Customize a component

Similarly, each component in the viewer can be customized separately depending on your design requirements. To do so, the styles of each component must be referenced in `PDFTronAppTheme`. For example:

{% tabs %}
{% tab title="XML" %}
{% code lineNumbers="true" %}

```xml
<style name="PDFTronAppTheme" parent="PDFTronAppThemeBase"> <!-- List of required attributes --> <item name="actionMenuTextColor">@color/app_color_icon</item> <item name="drawerArrowStyle">@style/DrawerArrowStyle</item> <item name="actionModeBackground">?attr/colorPrimary</item> <item name="windowActionModeOverlay">true</item> <!-- Custom annotation toolbar style (defined below) --> <item name="annotation_toolbar">@style/ToolbarButtonNavigationStyle</item> </style>

<style name="CustomAnnotationToolbarStyle" parent="AnnotationToolbarStyle"> <item name="colorToolBackground">@color/annotation_tool_background</item> <item name="colorToolIcon">@color/app_color_icon</item> <item name="colorCloseIcon">@color/app_color_icon</item> </style>
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Customizable components

For a full list of component styles available, please take a look at the default styles for PDFTronAppTheme in `styles.xml` of the Tools package.

A sample that uses styles to customize the document viewer can be found on our \[GitHub repository]\(<https://github.com/ApryseSDK/pdftron-android-samples/tree/master/CustomUI>).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.apryse.com/android/ui-customization/custom-theme-a.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
