Skip to content

Instantly share code, notes, and snippets.

@Gazer Gazer/PagerIndicator.java Secret
Created Sep 19, 2016

Embed
What would you like to do?
public class PagerIndicator extends View {
// Constructors and other methods
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (isInEditMode()) {
drawDots(canvas, 5, 2);
return;
}
if (pager != null) {
int total = pager.getAdapter().getCount();
int currentPage = pager.getCurrentItem();
drawDots(canvas, total, currentPage);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.