diff --git a/demo/src/main/res/values/styles.xml b/demo/src/main/res/values/styles.xml index 5885930..93c34e5 100644 --- a/demo/src/main/res/values/styles.xml +++ b/demo/src/main/res/values/styles.xml @@ -1,11 +1,7 @@ - - - diff --git a/scrollingpagerindicator/src/main/AndroidManifest.xml b/scrollingpagerindicator/src/main/AndroidManifest.xml index 922895f..7340c90 100644 --- a/scrollingpagerindicator/src/main/AndroidManifest.xml +++ b/scrollingpagerindicator/src/main/AndroidManifest.xml @@ -1,2 +1 @@ - + diff --git a/scrollingpagerindicator/src/main/java/ru/tinkoff/scrollingpagerindicator/ScrollingPagerIndicator.java b/scrollingpagerindicator/src/main/java/ru/tinkoff/scrollingpagerindicator/ScrollingPagerIndicator.java index 2c58d2f..d5580ba 100644 --- a/scrollingpagerindicator/src/main/java/ru/tinkoff/scrollingpagerindicator/ScrollingPagerIndicator.java +++ b/scrollingpagerindicator/src/main/java/ru/tinkoff/scrollingpagerindicator/ScrollingPagerIndicator.java @@ -57,14 +57,14 @@ public ScrollingPagerIndicator(Context context) { } public ScrollingPagerIndicator(Context context, @Nullable AttributeSet attrs) { - this(context, attrs, R.style.ScrollingPagerIndicator); + this(context, attrs, 0); } public ScrollingPagerIndicator(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); TypedArray attributes = context.obtainStyledAttributes( - attrs, R.styleable.ScrollingPagerIndicator, 0, R.style.ScrollingPagerIndicator); + attrs, R.styleable.ScrollingPagerIndicator, defStyleAttr, R.style.ScrollingPagerIndicator); dotColor = attributes.getColor(R.styleable.ScrollingPagerIndicator_spi_dotColor, 0); selectedDotColor = attributes.getColor(R.styleable.ScrollingPagerIndicator_spi_dotSelectedColor, dotColor); dotNormalSize = attributes.getDimensionPixelSize(R.styleable.ScrollingPagerIndicator_spi_dotSize, 0); @@ -78,6 +78,11 @@ public ScrollingPagerIndicator(Context context, @Nullable AttributeSet attrs, in paint = new Paint(); paint.setAntiAlias(true); + + if (isInEditMode()) { + setDotCount(visibleDotCount); + onPageScrolled(visibleDotCount / 2, 0); + } } /** diff --git a/scrollingpagerindicator/src/main/res/values/styles.xml b/scrollingpagerindicator/src/main/res/values/styles.xml index 0adb42c..151e098 100644 --- a/scrollingpagerindicator/src/main/res/values/styles.xml +++ b/scrollingpagerindicator/src/main/res/values/styles.xml @@ -1,6 +1,5 @@ -