Giter VIP home page Giter VIP logo

dotsindicator's Introduction

Material View Pager Dots Indicator

awesome Download

This library makes it possible to represent View Pager Dots Indicator with 3 different awesome styles !

materialdots

Check out the sample demo: sampledemo

Don't forget to star the project if you like it! star == heart

ezgif com-optimize ezgif com-crop 8

How to

Gradle

dependencies {
    implementation 'com.tbuonomo.andrui:viewpagerdotsindicator:2.1.0'
}

DotsIndicator

ezgif com-crop 1 ezgif com-crop 3

In your XML layout

<com.tbuonomo.viewpagerdotsindicator.DotsIndicator
    android:id="@+id/dots_indicator"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:dotsColor="@color/material_white"
    app:dotsCornerRadius="8dp"
    app:dotsSize="16dp"
    app:dotsSpacing="4dp"
    app:dotsWidthFactor="2.5"
    />

Custom Attributes

Attribute Description
dotsColor Color of the dots
dotsSize Size in dp of the dots (by default 16dp)
dotsSpacing Size in dp of the space between the dots (by default 4dp)
dotsWidthFactor The dots scale factor for page indication (by default 2.5)
dotsCornerRadius The dots corner radius (by default the half of dotsSize for circularity)

In your Java code

    dotsIndicator = (DotsIndicator) findViewById(R.id.dots_indicator);
    viewPager = (ViewPager) findViewById(R.id.view_pager);
    adapter = new ViewPagerAdapter();
    viewPager.setAdapter(adapter);
    dotsIndicator.setViewPager(viewPager);

In your Kotlin code

    val dotsIndicator = findViewById<WormDotsIndicator>(R.id.dots_indicator)
    val viewPager = findViewById<ViewPager>(R.id.view_pager)
    val adapter = ViewPagerAdapter()
    viewPager.adapter = adapter
    dotsIndicator.setViewPager(viewPager)

SpringDotsIndicator

ezgif com-crop 4 ezgif com-crop 5

In your XML layout

<com.tbuonomo.viewpagerdotsindicator.SpringDotsIndicator
    android:id="@+id/spring_dots_indicator"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:dampingRatio="0.5"
    app:dotsColor="@color/material_white"
    app:dotsStrokeColor="@color/material_yellow"
    app:dotsCornerRadius="2dp"
    app:dotsSize="16dp"
    app:dotsSpacing="6dp"
    app:dotsStrokeWidth="2dp"
    app:stiffness="300"
    />

Custom Attributes

Attribute Description
dotsColor Color of the indicator dot
dotsColor Color of the stroke dots (by default the indicator color)
dotsSize Size in dp of the dots (by default 16dp)
dotsSpacing Size in dp of the space between the dots (by default 4dp)
dotsCornerRadius The dots corner radius (by default the half of dotsSize for circularity)
dotsStrokeWidth The dots stroke width (by default 2dp)
dampingRatio The damping ratio of the spring force (by default 0.5)
stiffness The stiffness of the spring force (by default 300)

In your Java code

    springDotsIndicator = (SpringDotsIndicator) findViewById(R.id.spring_dots_indicator);
    viewPager = (ViewPager) findViewById(R.id.view_pager);
    adapter = new ViewPagerAdapter();
    viewPager.setAdapter(adapter);
    springDotsIndicator.setViewPager(viewPager);

In your Kotlin code

    val springDotsIndicator = findViewById<WormDotsIndicator>(R.id.spring_dots_indicator)
    val viewPager = findViewById<ViewPager>(R.id.view_pager)
    val adapter = ViewPagerAdapter()
    viewPager.adapter = adapter
    springDotsIndicator.setViewPager(viewPager)

WormDotsIndicator

ezgif com-crop 6 ezgif com-crop 7

In your XML layout

<com.tbuonomo.viewpagerdotsindicator.WormDotsIndicator
    android:id="@+id/worm_dots_indicator"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:dotsColor="@color/material_blueA200"
    app:dotsStrokeColor="@color/material_yellow"
    app:dotsCornerRadius="8dp"
    app:dotsSize="16dp"
    app:dotsSpacing="4dp"
    app:dotsStrokeWidth="2dp"
    />

Custom Attributes

Attribute Description
dotsColor Color of the indicator dot
dotsColor Color of the stroke dots (by default the indicator color)
dotsSize Size in dp of the dots (by default 16dp)
dotsSpacing Size in dp of the space between the dots (by default 4dp)
dotsCornerRadius The dots corner radius (by default the half of dotsSize for circularity)
dotsStrokeWidth The dots stroke width (by default 2dp)

In your Java code

    wormDotsIndicator = (WormDotsIndicator) findViewById(R.id.worm_dots_indicator);
    viewPager = (ViewPager) findViewById(R.id.view_pager);
    adapter = new ViewPagerAdapter();
    viewPager.setAdapter(adapter);
    wormDotsIndicator.setViewPager(viewPager);

In your Kotlin code

    val wormDotsIndicator = findViewById<WormDotsIndicator>(R.id.worm_dots_indicator)
    val viewPager = findViewById<ViewPager>(R.id.view_pager)
    val adapter = ViewPagerAdapter()
    viewPager.adapter = adapter
    wormDotsIndicator.setViewPager(viewPager)

Changelog

2.1.0

  • Add attribute dotsStrokeColor to SpringDotsIndicator and WormDotsIndicator

License

Copyright 2016 Tommy Buonomo

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.

dotsindicator's People

Contributors

rayliverified avatar tommybuonomo avatar

Watchers

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