android - Chrome 自定义选项卡、隐藏关闭按钮和处理设备后退按钮

标签 android xamarin xamarin.android chrome-custom-tabs

我在 Xamarin Android 应用程序中使用 chrome 自定义选项卡并打开一个 google 页面 url(这将是我将来的网站 url),我想知道是否可以隐藏关闭按钮?目前,如果用户关闭自定义选项卡,则会显示空白页面,我不希望用户关闭该选项卡。

enter image description here

其次,如果用户按下设备后退按钮,也会发生同样的情况,显示空白页面。

我可以做哪些事情?

最佳答案

就关闭按钮而言,不,您无法删除它。您可以将其从 X 更改为后退箭头,但仅此而已。

Chrome 自定义选项卡并非旨在用作嵌入式浏览器,而是作为一种打开您的外部内容、Auth2 流程、显示不在您域内的链接等的方式。让用户保持在您的应用体验中,一旦他们完成外部内容,他们就会通过关闭按钮或软/硬后退按钮返回您的应用。

如果您正在寻找嵌入式浏览器,Google/Chrome 的开发团队仍然建议使用 WebView

If you want the user to feel like Custom Tabs is a modal dialog, use the default “X” button. If you want the user to feel the Custom Tab is part of the application flow, use the back arrow.

回复:https://developer.chrome.com/multidevice/android/customtabs

关于android - Chrome 自定义选项卡、隐藏关闭按钮和处理设备后退按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48802327/

相关文章:

xamarin - 如何在 XAML 中制作特定于平台的relativelayout.xconstraint?

android - ImageButton 在 MVVMCross 中的可见性

android - 文字量大如何写出特色

android - Xamarin Android ListView 的垂直滚动

java - 在 Android 上,SQLiteDatabase.Insert() 或 SQLiteDatabase.execSQL() 哪个更快?

java - 如何使 4 个微调器相互依赖

c# - 资源不包含 Id 的定义 - c# Xamarin Visual Studio

android - 如果 Activity 被销毁,我可以从 Activity 调用静态方法吗?

java.lang.OutOfMemoryError : OutOfMemoryError thrown while trying to throw OutOfMemoryError; no stack trace available 错误

android - 在 Android Samsung Galaxy S 上播放流音频的问题