All Projects → TinkoffCreditSystems → Scrollingpagerindicator

TinkoffCreditSystems / Scrollingpagerindicator

Licence: apache-2.0
Pager indicator inspired by Instagram. Lightweight and easy to set up.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Scrollingpagerindicator

Pageindicator
An Instagram like page indicator compatible with RecyclerView and ViewPager.
Stars: ✭ 236 (-43.68%)
Mutual labels:  instagram, recyclerview, android-ui, viewpager, indicator
Bubblepagerindicator
A view pager indicator view to deal with a large amount of pages.
Stars: ✭ 127 (-69.69%)
Mutual labels:  instagram, viewpager, indicator
Discretescrollview
A scrollable list of items that centers the current element and provides easy-to-use APIs for cool item animations.
Stars: ✭ 5,533 (+1220.53%)
Mutual labels:  recyclerview, android-ui, viewpager
ArcPageIndicator
Android Page Indicator for ViewPager with original animations. It uses an ellipse to dispose indication spots, and can draw a hand, like in old elevators.
Stars: ✭ 73 (-82.58%)
Mutual labels:  viewpager, android-ui, indicator
Tableview
TableView is a powerful Android library for displaying complex data structures and rendering tabular data composed of rows, columns and cells.
Stars: ✭ 2,928 (+598.81%)
Mutual labels:  recyclerview, android-ui
Banner
🔥🔥ViewPager,ViewPager2无限轮播功能。自定义Indicator,支持一屏三页,支持仿魅族banner效果。极其简单的使用方式
Stars: ✭ 393 (-6.21%)
Mutual labels:  viewpager, indicator
Viewpagerbottomsheet
Use ViewPagers in Bottom Sheets!
Stars: ✭ 393 (-6.21%)
Mutual labels:  android-ui, viewpager
Cardslideview
一行代码实现ViewPager卡片效果,比ViewPager2更强大,底层同样是RecyclerView
Stars: ✭ 301 (-28.16%)
Mutual labels:  recyclerview, viewpager
Reside-Menu
By applying viewpager animation you can also make AMAZING Reside Menu's
Stars: ✭ 72 (-82.82%)
Mutual labels:  viewpager, android-ui
Cmpagetitleview
✍️一分钟集成类似抖音,新浪微博,腾讯视频,网易新闻,今日头条等常见的标题栏样式,api灵活易扩展,支持Cocoapods和Masonry布局,支持ChildController的完整生命周期
Stars: ✭ 270 (-35.56%)
Mutual labels:  viewpager, indicator
Loopingviewpager
A ViewPager and PagerAdapter combination that support auto scroll, infinite loop and page indicators.
Stars: ✭ 310 (-26.01%)
Mutual labels:  viewpager, indicator
RecyclerELE
Android Library for easy addition of Empty, Loading and Error views in a RecyclerView
Stars: ✭ 27 (-93.56%)
Mutual labels:  recyclerview, android-ui
BalloonPopup
Forget Android Toast! BalloonPopup displays a round or squared popup and attaches it to a View, like a callout. Uses the Builder pattern for maximum ease. The popup can automatically hide and can persist when the value is updated.
Stars: ✭ 32 (-92.36%)
Mutual labels:  android-ui, indicator
Transformerslayout
🔥 App金刚区导航菜单,类似淘宝、QQ音乐等APP导航,方格布局横向多行滑动翻页带滚动条
Stars: ✭ 258 (-38.42%)
Mutual labels:  recyclerview, viewpager
CeilingLayout
CeilingLayout用来控制子View的吸顶联滑,理论上支持实现了NestedScrollingChild的联滑控件,如NestedScrollView、RecyclerView、SmartRefreshLayout等;只需要在xml里配置需要吸顶子View的位置索引就能自动实现吸顶联滑效果。
Stars: ✭ 26 (-93.79%)
Mutual labels:  recyclerview, android-ui
Ispagecontrol
A page control similar to that used in Instagram
Stars: ✭ 285 (-31.98%)
Mutual labels:  instagram, indicator
Recyclerstickyheaderview
Sticky header view or suspending view for RecyclerView.
Stars: ✭ 347 (-17.18%)
Mutual labels:  recyclerview, android-ui
Stacklayoutmanager
customized layoutmanager,let item pile up like stackview/类似最美有物卡片堆叠效果
Stars: ✭ 343 (-18.14%)
Mutual labels:  recyclerview, android-ui
Indicatorscrollview
🧀 A dynamic scroll view that animates indicators according to its scroll position.
Stars: ✭ 355 (-15.27%)
Mutual labels:  android-ui, indicator
Viewpagerindicator
一个简单好用的ViewPagerIndicator,提供了六种类型,为viewpager添加酷炫效果,并且支持轮播图( A simple, cool, customizable ViewPagerIndicator.show cool indicator for viewpager , it also good for viewpager as carousel )
Stars: ✭ 366 (-12.65%)
Mutual labels:  viewpager, indicator

Maven Central

ScrollingPagerIndicator

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

Supports ViewPager, RecyclerView and attaching to custom pagers.

preview preview

Getting started

Add dependency to Gradle script:

implementation "ru.tinkoff.scrollingpagerindicator:scrollingpagerindicator:x.x.x"

Attach to ViewPager

  1. 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"
  1. Add view to layout:
<android.support.v4.view.ViewPager
    android:id="@+id/pager"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />

<ru.tinkoff.scrollingpagerindicator.ScrollingPagerIndicator
    android:id="@+id/indicator"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

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

  1. 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

  1. Ensure that you have RecyclerView in dependencies:
implementation "com.android.support:recyclerview-v7:x.x.x"
  1. Add view to layout:
<android.support.v7.widget.RecyclerView
    android:id="@+id/recycler"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>

<ru.tinkoff.scrollingpagerindicator.ScrollingPagerIndicator
    android:id="@+id/indicator"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />
  1. 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);
  1. Determine which page is current in RecyclerView:

Use attachToRecyclerView(RecyclerView) if current page of the recycler is centered. Like this:

+------------------------------+
|---+  +----------------+  +---|
|   |  |     current    |  |   |
|   |  |      page      |  |   |
|---+  +----------------+  +---|
+------------------------------+

Use attachToRecyclerView(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 LinearLayoutManager is supported.

Attach to any custom pager

If you want to attach indicator to some custom pager, you have to implement ScrollingPagerIndicator.PagerAttacher interface. You can take look at ru.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. 6dp
spi_dotSelectedSize The diameter of a currently selected dot. 10dp
spi_dotColor The color of a dot. @android:color/darker_gray
spi_dotSelectedColor The color of the currently selected dot. @android:color/darker_gray
spi_dotSpacing The distance from center to center of each dot. 8dp
spi_visibleDotCount The maximum number of dots which will be visible at the same time. If pager has more pages than visible_dot_count, indicator will scroll to show extra dots. Must be odd number. 5
spi_visibleDotThreshold The minimum number of dots which should be visible. If pager has less pages than visibleDotThreshold, no dots will be shown. 2
spi_looped The mode for looped pagers support. You should make indicator looped if your custom pager is looped too. If pager has less items than spi_visibleDotCount, indicator will work as usual; otherwise it will always be in infinite state. false
spi_dotMinimumSize The minimum dot size for the corner dots. This size is lower or equal to spi_dotSize and greater or equal to the internal calculation for the corner dots. Internal calculation based on spi_dotSize, spi_dotSelectedSize and spi_dotSpacing
spi_orientation Visible orientation of the dots LinearLayoutManager.HORIZONTAL

TODO

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

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].