问题
Is it possible to override the behaviour of the default close button on custom chrome tabs in Android? For example instead of just closing the chrome tab, can we redirect to a new Activity, or launch a dialog?
回答1:
I'm not sure if you can do that. You can try to start the CustomTabIntent for result and wait for it finish and start it from onActivityResult()
based on the requestCode
you have started it with.
private void openUrlForResult(CustomTabsIntent customTabsIntent, String url, int requestCode){
customTabsIntent.intent.setData(Uri.parse(url));
startActivityForResult(customTabsIntent.intent, requestCode);
}
来源:https://stackoverflow.com/questions/33809146/custom-close-button-for-chrome-custom-tab