tinkoff-mobile-tech
ScrollingPagerIndicator
Java

Pager indicator inspired by Instagram. Lightweight and easy to set up.

Last updated Jul 4, 2026
677
Stars
102
Forks
18
Issues
+1
Stars/day
Attention Score
51
Language breakdown
No language data available.
โ–ธ Files click to expand
README

[![Maven Central][img version shield]][maven]

ScrollingPagerIndicator ======================= Pager indicator inspired by Instagram. Lightweight and easy to set up.

Supports ViewPager, RecyclerView and attaching to custom pagers.

preview preview Custom drawables

Getting started

Add dependency to Gradle script:
implementation "ru.tinkoff.scrollingpagerindicator:scrollingpagerindicator:x.x.x"

Attach to ViewPager

  • Ensure that you have ViewPager in dependencies:
implementation "androidx.viewpager:viewpager:x.x.x"
or
implementation "androidx.viewpager2:viewpager2:x.x.x"
or
implementation "androidx.recyclerview:recyclerview:x.x.x"
  • Add view to layout:
<androidx.viewpager.widget.ViewPager
    android:id="@+id/pager"
    android:layoutwidth="matchparent"
    android:layoutheight="wrapcontent" />

<ru.tinkoff.scrollingpagerindicator.ScrollingPagerIndicator android:id="@+id/indicator" android:layoutwidth="wrapcontent" android:layoutheight="wrapcontent" />

There is no possibility to set fixed indicator width (because it's width is based on
).

  • Attach indicator to ViewPager:
ViewPager pager = findViewById(R.id.pager);
pager.setAdapter(new DemoPagerAdapter());
ScaledDotsIndicator indicator = findViewById(R.id.indicator);
indicator.attachToPager(pager);

Attach to RecyclerView

  • Ensure that you have RecyclerView in dependencies:
implementation "androidx.recyclerview:recyclerview:x.x.x"
  • Add view to layout:
<androidx.recyclerview.widget.RecyclerView
    android:id="@+id/recycler"
    android:layoutwidth="matchparent"
    android:layoutheight="wrapcontent"/>

<ru.tinkoff.scrollingpagerindicator.ScrollingPagerIndicator android:id="@+id/indicator" android:layoutwidth="wrapcontent" android:layoutheight="wrapcontent" />

  • Attach indicator to RecyclerView:
RecyclerView recyclerView = findViewById(R.id.recycler); LayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false); recyclerView.setLayoutManager(layoutManager); DemoRecyclerViewAdapter recyclerAdapter = new DemoRecyclerViewAdapter(); recyclerView.setAdapter(recyclerAdapter);

ScrollingPagerIndicator recyclerIndicator = findViewById(R.id.indicator); recyclerIndicator.attachToRecyclerView(recyclerView);

  • Determine which page is current in RecyclerView:
Use
(RecyclerView)
if current page of the recycler is centered. Like this:
+------------------------------+ |---+  +----------------+  +---| |   |  |     current    |  |   | |   |  |      page      |  |   | |---+  +----------------+  +---| +------------------------------+
Use
(RecyclerView recyclerView, int currentPageLeftCornerX)
if current page of the recycler isn't centered. Like this:
+-|----------------------------+ | +--------+  +--------+  +----+ | | current|  |        |  |    | | |  page  |  |        |  |    | | +--------+  +--------+  +----| +-|----------------------------+   |   | currentPageLeftCornerX
In both cases all views in RecyclerView must have the same width. Only
is supported.

Attach to any custom pager

If you want to attach indicator to some custom pager, you have to implement
.PagerAttacher
interface. You can take look at
.tinkoff.scrollingpagerindicator.ViewPagerAttacher
as implementation example. And then you can attach your pager like this:
indicator.attachToPager(pager, new ViewPagerAttacher());

Customization

| Attribute | Explanation | Default Value | |-------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------| | spi_dotSize | The diameter of a dot. |
| | spi_dotSelectedSize | The diameter of a currently selected dot. |
| | spidotColor | The color of a dot. |
@android:color/darkergray
| | spidotSelectedColor | The color of the currently selected dot. |
@android:color/darkergray
| | spi_dotSpacing | The distance from center to center of each dot. |
| | spivisibleDotCount | The maximum number of dots which will be visible at the same time. If pager has more pages than visibledot_count, indicator will scroll to show extra dots. Must be odd number. |
| | spi_visibleDotThreshold | The minimum number of dots which should be visible. If pager has less pages than visibleDotThreshold, no dots will be shown. |
| | spilooped | The mode for looped pagers support. You should make indicator looped if your custom pager is looped too. If pager has less items than
, indicator will work as usual; otherwise it will always be in infinite state. |
| | spidotMinimumSize | The minimum dot size for the corner dots. This size is lower or equal to
and greater or equal to the internal calculation for the corner dots. | Internal calculation based on
,
and
| | spi_orientation | Visible orientation of the dots | LinearLayoutManager.HORIZONTAL | | spi_firstDotDrawable | Custom drawable of the first dot, color is tinted and size is changed like standard dots. If first dot is also the last one then this value is taken into account. | null | | spi_lastDotDrawable | Custom drawable of the last dot, color is tinted and size is changed like standard dots. | null |

TODO

  • Some extreme customizations may work incorrect.
  • There is no possibility to set fixed indicator width (because it's width is based on
    ).

License

Copyright 2018 Tinkoff Bank

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

[img version shield]: https://img.shields.io/maven-central/v/ru.tinkoff.scrollingpagerindicator/scrollingpagerindicator.svg?maxAge=3600 [maven]: https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22ru.tinkoff.scrollingpagerindicator%22

ยฉ 2026 GitRepoTrend ยท tinkoff-mobile-tech/ScrollingPagerIndicator ยท Updated daily from GitHub