Skip to content
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

如何给targetView设置点击事件监听 #63

Open
kaishuiWang opened this issue Nov 26, 2019 · 2 comments
Open

如何给targetView设置点击事件监听 #63

kaishuiWang opened this issue Nov 26, 2019 · 2 comments

Comments

@kaishuiWang
Copy link

你好,项目中引用guideView,
1.需要在点击了targetView时监听事件,但好像没有相应的监听api。
2.需要在页面设置5个控件的引导,点击一个出现下一个引导,5个引导,现在有个场景,页面底部固定一个button,请问这如何实现
有知道的同学解答下,谢谢,在线等

@binIoter
Copy link
Owner

问题1:你可以参考onSlideListener的实现,自行实现,目前点击默认dismiss处理。
@OverRide
public boolean onTouch(View view, MotionEvent motionEvent) {
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
startY = motionEvent.getY();
} else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
if (startY - motionEvent.getY() > DimenUtil.dp2px(view.getContext(), SLIDE_THRESHOLD)) {
if (mOnSlideListener != null) {
mOnSlideListener.onSlideListener(GuideBuilder.SlideState.UP);
}
} else if (motionEvent.getY() - startY > DimenUtil.dp2px(view.getContext(), SLIDE_THRESHOLD)) {
if (mOnSlideListener != null) {
mOnSlideListener.onSlideListener(GuideBuilder.SlideState.DOWN);
}
}else{
// todo 处理点击
}
if (mConfiguration != null && mConfiguration.mAutoDismiss) {
dismiss();
}
}
return true;
}
问题2,本库是支持串联依次展示的,参见demo

@CantonTower
Copy link

在Component中加回调接口

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants