explaingit

zhpanvip/bannerviewpager

3,781JavaAudience · developerComplexity · 2/5Setup · easy

TLDR

An Android library for building auto-scrolling image carousels (banners) with swipe gestures, page indicators, and multiple display styles, built on top of ViewPager2.

Mindmap

mindmap
  root((bannerviewpager))
    What it does
      Image carousel
      Auto-looping
      Swipe gestures
    Display styles
      Full-width
      Edge peek
      Overlapping scale
    Indicators
      Circle dots
      Dash style
      Custom indicator
    Tech
      Java
      ViewPager2
      Android API 19+
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Add an auto-looping image banner to the top of your Android shopping or media app.

USE CASE 2

Show a peek of the previous and next images so users know there is more content to swipe through.

USE CASE 3

Display a fully custom dot or dash indicator that animates as the user swipes between pages.

USE CASE 4

Replicate the banner style used by popular apps like Bilibili or Taobao in your own Android project.

Tech stack

JavaAndroidViewPager2JitPack

Getting it running

Difficulty · easy Time to first run · 30min

Distributed via JitPack, add the JitPack maven URL to your project build.gradle and the dependency to your module build.gradle.

Open-source library, check the repository for the specific license terms.

In plain English

BannerViewPager is an Android library for building image carousels, commonly called banners, inside mobile apps. A banner is the horizontally scrolling set of images you see at the top of apps like shopping platforms, music apps, or video services. This library handles all the mechanics of that: automatic looping, swipe gestures, smooth transitions between pages, and the small dot or line indicators that show which page you are on. The library is built on top of Android's ViewPager2 component, which is the current standard way to handle swipeable page views in Android. The author notes that popular Chinese apps including Tencent Video, QQ Music, Taobao, and Bilibili all use banner patterns that BannerViewPager can replicate. There are several display styles you can choose from. The default shows one image at a time filling the full width. Other styles show part of the previous and next pages peeking in from the edges, so users can see there is more content to swipe to. You can also configure the pages to overlap or scale relative to each other as they scroll. The indicator system, which is the row of dots or dashes showing the current page position, is a separate library called ViewPagerIndicator that was split out from this project. It supports three visual shapes (circle, dash, and rounded rectangle) and five animation styles for how the indicator moves when you swipe. You can also build a fully custom indicator by extending a base class and drawing whatever shape you want. The library supports Android devices running API level 19 and above, which covers Android 4.4 and later. It is distributed through JitPack, a service that lets Android projects pull libraries directly from GitHub. Integration is done by adding a few lines to the project's build files and then adding the view component to an XML layout. Full documentation is on the project's wiki.

Copy-paste prompts

Prompt 1
Show me how to add BannerViewPager to my Android project via JitPack and display a list of image URLs in an auto-looping carousel.
Prompt 2
How do I configure BannerViewPager to show partial previews of the previous and next pages peeking in from the edges?
Prompt 3
Walk me through customising the page indicator in BannerViewPager, I want a rounded-rectangle style that slides smoothly between positions.
Prompt 4
How do I listen for page-click events in BannerViewPager so I can open a detail screen when the user taps a banner image?
Open on GitHub → Explain another repo

← zhpanvip on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.