Closed ghost closed 6 years ago
SimpleTarget simpleTarget = new SimpleTarget.Builder(this)
//location 1 = kiri kanan, location 2 = atas bawah
.setPoint(findViewById(R.id.view1)) // position of the Target. setPoint(Point point), setPoint(View view) will work too.
.setRadius(200f) // radius of the Target
.setTitle(getResources().getString(R.string.preview_step1_title))
.setDescription(getResources().getString(R.string.preview_step1_text))
.setOnSpotlightStartedListener(new OnTargetStateChangedListener
@Override
public void onEnded(SimpleTarget target) {
// do something
}
})
.build();
Spotlight.with(PreviewActivity.this)
.setOverlayColor(ContextCompat.getColor(PreviewActivity.this, R.color.background))
.setDuration(1000L)
.setAnimation(new DecelerateInterpolator(2f))
.setTargets(simpleTarget)
.setClosedOnTouchedOutside(true)
.setOnSpotlightStartedListener(new OnSpotlightStartedListener() {
@Override
public void onStarted() {
}
})
.setOnSpotlightEndedListener(new OnSpotlightEndedListener() {
@Override
public void onEnded() {
ll1.setVisibility(View.VISIBLE);
btnClose1.setVisibility(View.VISIBLE);
btnNext1.setVisibility(View.VISIBLE);
}
})
.start();
Can you give me a screenshot of how the spotlight isnt fit.
I had the same issue, the spotligth isn't fit
Code:
Spotlight.with(this)
.setOverlayColor(ContextCompat.getColor(this,R.color.background))
.setDuration(1000L)
.setAnimation(DecelerateInterpolator(2f))
.setTargets(
SimpleTarget.Builder(this)
.setPoint(100f,Intentos.y)
.setRadius(100f)
.setTitle("Intentos")
.setDescription("Este es el contador de los intentos que has realizado,recuerada el maximo es 20!!.")
.build()
,
SimpleTarget.Builder(this)
.setPoint(Chronometer.x, Chronometer.y)
.setRadius(100f)
.setTitle("Cronometro")
.setDescription("Tiempo que ha pasado mientras intentas adivinar la palabra.")
.build()
,
SimpleTarget.Builder(this)
.setPoint(horizontalScrollView.x , horizontalScrollView.y)
.setTitle("Letras")
.setDescription("Cada botón representa una letra o caracter, puedes buscar el que necesites pasando el dedo de izquierda a derecha o viceversa")
.build()
)
.setClosedOnTouchedOutside(true)
.setOnSpotlightStartedListener {
}
.setOnSpotlightEndedListener {
}
.start()
Image:
Can you try after view is located as I described in Read.me?
view.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override public void onGlobalLayout() {
view.getViewTreeObserver().removeOnGlobalLayoutListener(this);
// show spotlight here
}
});
Instrucciones.getViewTreeObserver().addOnGlobalLayoutListener{
object : ViewTreeObserver.OnGlobalLayoutListener {
override fun onGlobalLayout() {
Instrucciones.viewTreeObserver.removeOnGlobalLayoutListener(this)
Spotlight.with(this@instructions)
.setOverlayColor(ContextCompat.getColor(this@instructions, R.color.background))
.setDuration(1000L)
.setAnimation(DecelerateInterpolator(2f))
.setTargets(
SimpleTarget.Builder(this@instructions)
.setPoint(Intentos)
.setRadius(100f)
.setTitle("Intentos")
.setDescription("Este es el contador de los intentos que has realizado,recuerada el maximo es 20!!.")
.build()
,
SimpleTarget.Builder(this@instructions)
.setPoint(Chronometer)
.setRadius(100f)
.setTitle("Cronometro")
.setDescription("Tiempo que ha pasado mientras intentas adivinar la palabra.")
.build()
,
SimpleTarget.Builder(this@instructions)
.setPoint(horizontalScrollView)
.setTitle("Letras")
.setDescription("Cada botón representa una letra o caracter, puedes buscar el que necesites pasando el dedo de izquierda a derecha o viceversa")
.build()
)
.setClosedOnTouchedOutside(true)
.setOnSpotlightStartedListener {
}
.setOnSpotlightEndedListener {
}
.start()
}
}
}
with this code the spotlight doesn't start/show
the code above, is the callback even called? you mean the callback of the onGlobalLayout is called but spotlight doesnt start?
sorry, closing this issue as not seeing your response.
Hi,
im trying to implement the library, but i cant put target as a view to method setPoint(textview1);
the round is not fit to the view..
any advice would help much.
thanks