Customizing the thumbnail file viewer on Android
The thumbnail bar is the component found on the bottom of our PdfActivity
by default, or as a standalone view named PdfThumbnailBar
.
To set the style of your thumbnail bar inside the PdfActivity
, you can use PdfActivityConfiguration.Builder#setThumbnailBarMode
(for custom layout implementation, see the CustomFragmentActivity
in our Catalog app), which takes the ThumbnailBarMode
enum as a parameter. These are the possible values:
-
THUMBNAIL_BAR_MODE_NONE
— hides the thumbnail bar
-
THUMBNAIL_BAR_MODE_FLOATING
— shows the floating thumbnail bar
-
THUMBNAIL_BAR_MODE_PINNED
— shows the thumbnail bar pinned to the bottom of the screen
-
THUMBNAIL_BAR_MODE_SCROLLABLE
— shows the scrollable thumbnail bar with larger thumbnails and without the border
To customize the look of your thumbnail bar (color, thumbnail width, thumbnail height, etc.) see the corresponding section in the Appearance Styling guide.
Gestural navigation support (Android Q+)
Google has announced gestural navigation as part of the Android Q navigation system. This change requires apps to update their bottom views so as not to interfere with the area reserved for gesture detection. Our floating thumbnail bar is designed with this in mind, and it will keep the necessary distance from the bottom of the screen.
The other two thumbnail bars (pinned and scrollable) were originally designed to be displayed at the bottom of the screen. They have also been redesigned to work with gestural navigation in fullscreen (immersive) mode by adding the padding on the bottom, so as not to obstruct gestural navigation touches.
Android Q introduces an option for fully gestural system navigation. There are two things that app developers should do to prepare for this feature:
-
Extend app content from edge to edge.
-
Handle conflicting app gestures.
⚠️ Warning: In order for pinned and scrollable thumbnail bars to work with gestural navigation, you must use the fullscreen mode in your activity. Otherwise, the bars will interfere with the gestural navigation area on the bottom.
ℹ️ Note: You can set the PdfActivity
to fullscreen/immersive mode via PdfActivityConfiguration.Builder#useImmersiveMode(true)
.