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

Customizing document viewer slider in Android

DocumentSlider is a RelativeLayout that contains an AppCompatSeekBar to change pages, and a PageIndicatorLayout on the top or side of the slider to show current page number when sliding.

Show document slider

To set up your layout with the document slider, add a <DocumentSlider> element to your XML layout. For example, your layout may look like this:

Then, attach a PDFViewCtrl to the document slider. If PDFViewCtrl is in the same layout, you can set it by adding the app:pdfviewctrlId attribute:

If PDFViewCtrl is not in the same layout, you can programmatically set it to a document slider by calling setPdfViewCtrl(PDFViewCtrl):

Document slider listeners

You can set a document slider seekbar event listener by calling setOnDocumentSliderTrackingListener to be notified when document slider touch tracking has started/stopped:

Appearance style

Customize slider colors

You can customize the color of the left and right menu buttons as well as the seekbar by setting a custom style to the pt_document_slider_style attribute in your apps's theme. The custom style must extend DocumentSliderStyle. For example:

XML attributes

Attribute
Description
Format

app:pdfviewctrlId

Specifies the PDFViewCtrl view id

Reference

app:colorBackground

Specifies background color. Uses default system background color if not defined.

Color

app:seekbarColor

Specifies seekbar progress bar and thumb color. Default value: ?attr/colorPrimary in day mode and @android:color/white in night mode.

Color

Last updated

Was this helpful?