[英]Handle back press with ShowcaseView
How can I handle a user pressing the back button, whilst a ShowcaseView is showing? 在ShowcaseView显示时,如何处理用户按下后退按钮? I want to be able to hide the ShowcaseView when they press back.
我希望能够在他们按回时隐藏ShowcaseView。
As linked from https://github.com/amlcurran/ShowcaseView/issues/376 链接自 https://github.com/amlcurran/ShowcaseView/issues/376
ShowcaseView allows you to query if it is showing or not. ShowcaseView允许您查询是否显示。 So, if a user presses back and it is showing, simply hide it using
Activity#onBackPressed()
: 因此,如果用户按下并显示它,只需使用
Activity#onBackPressed()
将其隐藏即可:
@Override
public void onBackPressed() {
if (sv.isShowing()) {
sv.hide();
} else {
super.onBackPressed();
}
}
Try this : 尝试这个 :
@Override
public void onBackPressed() {
// in if condition check showcaseview is show or hide
if(isShowcaseViewShow==true) {
// here hide your showcase view
}
else{
// here perform back action if view already hide
super.onBackPressed();
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.