-
Notifications
You must be signed in to change notification settings - Fork 124
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
Request: allow showing near touch position #10
Comments
This library supports showing popup with offset. fun View.setOnClickPositionListener(listener: (v: View, x: Float, y: Float) -> Unit) {
var tapPosition = PointF()
setOnTouchListener { _, event ->
if (event.actionMasked == MotionEvent.ACTION_DOWN) {
tapPosition = PointF(event.x, event.y)
}
false
}
setOnClickListener { v ->
listener(v, tapPosition.x, tapPosition.y)
}
}
anchorView.setOnClickPositionListener { v, x, y ->
val popup = RelativePopupWindow(v.context).apply {
width = ViewGroup.LayoutParams.WRAP_CONTENT
height = ViewGroup.LayoutParams.WRAP_CONTENT
...
}
val vertPos = RelativePopupWindow.VerticalPosition.ALIGN_TOP
val horizPos = RelativePopupWindow.HorizontalPosition.ALIGN_LEFT
popup.showOnAnchor(v, vertPos, horizPos, x.toInt(), y.toInt(), true)
} |
setOnClickPositionListener is not a standard function. |
Then use the ContextMenu. |
ContextMenu doesn't support customized view to be set to it. |
Too bad |
Similar to this:
https://stackoverflow.com/q/57290574/878126
The text was updated successfully, but these errors were encountered: