You can set a document slider seekbar event listener by calling setOnDocumentSliderTrackingListener to be notified when document slider touch tracking has started/stopped:
2 override fun onDocumentSliderStartTrackingTouch() {
3 // Called when tracking on the seekbar has started
4 }
5
6 override fun onDocumentSliderStopTrackingTouch(pageNum: Int) {
7 // Called when tracking on the seekbar has stopped
8 }
9})
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:
Java
1<style name="PDFTronAppTheme" parent="PDFTronAppThemeBase"> <item name="colorPrimary">@color/app_color_primary_day</item> <item name="colorPrimaryDark">@color/app_color_primary_dark_day</item> <item name="colorAccent">@color/app_color_accent</item> <!-- Set your custom style in your app theme --> <item name="pt_document_slider_style">@style/CustomDocumentSliderStyle</item> </style>
2
3<style name="CustomDocumentSliderStyle" parent="DocumentSliderStyle"> <!-- Change the background color of the slider--> <item name="colorBackground">@android:color/red</item> <!-- Change the color of the seekbar and seekbar icon in the slider--> <item name="seekbarColor">@android:color/black</item> </style>
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.