-
Notifications
You must be signed in to change notification settings - Fork 377
Change indicator color? #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
return newTutorialOptionsBuilder(getContext())
.setIndicatorOptions(IndicatorOptions.newBuilder(getContext())
.setElementColor(...) // non-selected color
.setSelectedElementColor(...) // selected color
.build())
.build(); If you not specified |
OK, so that's exactly what i did, except as soon as i do that, the indicator is no longer rendered. See original question. Removing the setIndicatorOptions then brings back the indicator. |
Have you tried to specify one of the default renderers? Renderer.Factory.newCircleRenderer()
Renderer.Factory.newSquareRenderer() |
No dice i'm afraid! Still nothing at all. |
There was an issue with Provide your code of XML layout for tutorial fragment and Java code with For now try to implement your own Renderer and draw using custom final Paint mElementPaint = ...; // init paint with non-selected color
final Paint mSelectedElementPaint = ...; // init paint with non-selected color
return newTutorialOptionsBuilder(getContext())
.setIndicatorOptions(IndicatorOptions.newBuilder(getContext())
.setRenderer(new Renderer() {
@Override
public void draw(@NonNull Canvas canvas, @NonNull RectF elementBounds, @NonNull Paint paint, boolean isActive) {
float radius = Math.min(elementBounds.width(), elementBounds.height());
radius /= 2f;
canvas.drawCircle(elementBounds.centerX(), elementBounds.centerY(), radius, isActive ? mSelectedElementPaint : mElementPaint);
}
})
.build())
.build(); |
You need to specify the size of elements as well as colors. @Override
protected TutorialOptions provideTutorialOptions() {
return newTutorialOptionsBuilder(getContext())
.setIndicatorOptions(IndicatorOptions.newBuilder(getContext())
// set this sizes
.setElementSizeRes(R.dimen.indicator_size)
.setElementSpacingRes(R.dimen.indicator_spacing)
.setElementColor(Color.CYAN)
.setSelectedElementColor(Color.RED)
.build())
.build();
} Currently the default value for elements and spacing size is zero. That's why it doesn't draw anything. |
I simply want to change the non-selected and selected colors but i seems i need to set some sort of renderer before it will draw them? If i don't specify one the indicator is now invisible, can i not use the "default" renderer?
The text was updated successfully, but these errors were encountered: