Custom Close Button for Chrome Custom Tab

懵懂的女人 提交于 2019-12-11 09:43:22

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!