/dotsindicator

A cool dots indicator for ViewPager in Android

Primary LanguageJavaApache License 2.0Apache-2.0

Material View Pager Dots Indicator

This is a cool Android View Pager Dots Indicator ready to be imported in your project.

ezgif com-crop ezgif com-crop 1 ezgif com-crop 2

How to

Gradle

dependencies {
    compile 'com.tbuonomo.andrui:viewpagerdotsindicator:1.0.1'
}

In your XML layout

  <com.tbuonomo.viewpagerdotsindicator.DotsIndicator
      android:id="@+id/dots_indicator"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_centerHorizontal="true"
      app:dotsColor="@color/colorPrimary"
      app:dotsSize="16dp"
      app:dotsWidthFactor="3"
      />

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);

Attributes

Attribute Description
dotsColor Color of the dots
dotsSize Size in dp of the dots (by default 8dp)
dotsWidthFactor The dots scale factor for page indication (by default 2.5)

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.