Giter Site home page Giter Site logo

androidsourcetools / androidscreenslidepager Goto Github PK

View Code? Open in Web Editor NEW

This project forked from liangfeidotme/androidscreenslidepager

0.0 1.0 0.0 9.53 MB

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

Home Page: http://liangfei.me

License: MIT License

Java 95.34% Kotlin 4.66%

androidscreenslidepager's Introduction

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)

androidscreenslidepager's People

Contributors

liangfeidotme avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.