Skip to content
This repository was archived by the owner on Jan 30, 2022. It is now read-only.

Pager (especially for ViewPager) indicator in two styles: circle & fraction.

License

Notifications You must be signed in to change notification settings

liangfeidotme/AndroidScreenSlidePager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

622bfab · Apr 24, 2019

History

30 Commits
Apr 23, 2019
Apr 23, 2019
Apr 23, 2019
Apr 23, 2019
Apr 23, 2019
Apr 23, 2019
Apr 23, 2019
Apr 23, 2019
Apr 24, 2019
Apr 23, 2019
Apr 23, 2019
Mar 26, 2015
Mar 26, 2015
Apr 23, 2019

Repository files navigation

PagerIndicator

Download

Pager (especially for ViewPager) indicator in two styles: circle & fraction.

Demo

circle fraction

Dependency

implementation 'me.liangfei:pagerindicator:0.0.2'

Usage

Two attributes are provided:

  • app:indicator_type = [fraction | circle].
  • app:indicator_spacing works only for the circle type indicator.

Step 1: add PageIndicator to the bottom of the ViewPager.

<merge xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <androidx.viewpager.widget.ViewPager
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <me.liangfei.indicator.PagerIndicator
        android:id="@+id/indicator"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginBottom="20dp"
        android:layout_marginLeft="20dp"
        android:layout_marginStart="20dp"
        android:gravity="bottom|center_horizontal"
        app:indicator_spacing="5dp"
        app:indicator_type="fraction" />
</merge>

Step 2: pass the ViewPager instance to the PagerIndicator instance.

val pageIndicator = findViewById(R.id.indicator);
pageIndicator.setViewPager(pager);

You can just take PageIndicator as a normal view to make your layout, because it extends LinearLayout.

Check the app module for more details.

dependencies

欢迎关注我的微信公众号(Chinese only)

About

Pager (especially for ViewPager) indicator in two styles: circle & fraction.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published