FancyShowCaseView: Can't get right focus height with focusRectAtPosition()
I’m setting the view using .focusRectAtPosition() and get focus height multiplied by 2.
// Calculate position
val centerY = onScreenY + cityNameTV.height / 2
val centerX = cityNameTV.left + cityNameTV.width / 2
val width = activity.getScreenWidth()
val height = resources.getDimensionPixelSize(R.dimen.city_showcase_height)
// Create showcase
FancyShowCaseView.Builder(activity)
.backgroundColor(ContextCompat.getColor(context, R.color.showcase))
.focusShape(FocusShape.ROUNDED_RECTANGLE)
.focusRectAtPosition(centerX, centerY, width, height)
.roundRectRadius(1) // Almost 0 :)
.disableFocusAnimation()
.customView(R.layout.layout_showcase_city) {
it.button.setOnClickListener { cityShowcase.hide() }
}
.closeOnTouch(false)
.exitAnimation(AnimationUtils.loadAnimation(context, R.anim.fscv_fade_out).apply {
setAnimationListener(object : Animation.AnimationListener {
override fun onAnimationEnd(animation: Animation?) {
cityShowcase.removeView()
}
override fun onAnimationRepeat(animation: Animation?) {}
override fun onAnimationStart(animation: Animation?) {}
})
})
.build()
Height is from dimensions:
<dimen name="city_showcase_height">12dp</dimen>
And I get the visual height of focus exactly as the status bar (24dp). Could you please help with this?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 15 (8 by maintainers)
Commits related to this issue
- Fix #57 - Set animCounter to 0 if animation is disabled — committed to faruktoptas/FancyShowCaseView by faruktoptas 7 years ago
Ok, I’ll let you know when the app will be released!
I’m fixing it now
If your root layout has
android:fitsSystemWindows="true"
then you need to add.fitSystemWindows(true)
toFancyShowCaseView
builder params.