A simple ViewPager indicator displaying colored dots for android. Shows how many pages are in the ViewPager and indicates the current page.
dependencies {
compile 'com.jenglert:dotviewpagerindicator:1.0.0'
}
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.ViewGroup;
import com.jenglert.dotviewpagerindicator.DotViewPagerIndicator;
public class MainActivity extends AppCompatActivity {
private ViewPager mViewPager;
private ExamplePagerAdapter mPagerAdapter;
private DotViewPagerIndicator mViewPagerIndicator;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mViewPager = (ViewPager)findViewById(R.id.view_pager);
mPagerAdapter = new ExamplePagerAdapter(getSupportFragmentManager());
mViewPager.setAdapter(mPagerAdapter);
mViewPagerIndicator = (DotViewPagerIndicator)findViewById(R.id.dotviewpagerindicator);
mViewPagerIndicator.setViewPager(mViewPager);
}
...
}