[英]Android WebView Wrapper (In-App Browser) behavior
On recent versions of Android, opening a link from Google Search it opens on a wrapped version of the Chrome within Google Search app and it offers a option on the menu to 'open with Chrome'. 在Android的最新版本中,打开Google搜索的链接会在Google搜索应用中的Chrome浏览器上打开,并在菜单上提供“使用Chrome打开”的选项。 This common pattern is also seen on other apps like Facebook, Twitter, etc. So basically it opens the link on a 'WebView wrapper' within the app instead of opening the Browser app.
这种常见模式也出现在Facebook,Twitter等其他应用程序上。因此,基本上它会在应用程序中的“WebView包装器”上打开链接,而不是打开浏览器应用程序。
An interesting thing is found on the one from Google Search, that when you click on the 'open with Chrome' it plays a very smooth transition to Chrome, like if it would get transformed into Chrome. 谷歌搜索的一个有趣的事情是,当你点击“打开Chrome”时,它可以非常平稳地过渡到Chrome,就好像它会转变为Chrome一样。
Is there any sample or library that kinda helps or wraps this behavior? 是否有任何样本或库有助于或包装这种行为? Or an 'in-app browser' that wraps this activity behavior.
或者是一个包含此活动行为的“应用内浏览器”。
Your probably looking for Chrome Custom Tabs as Morrison Chang already mentioned. 您可能正在寻找Chrome自定义标签,正如Morrison Chang已经提到过的那样。
Add compile 'com.android.support:customtabs:26.0.2'
to your build.gradle file. 将
compile 'com.android.support:customtabs:26.0.2'
添加到build.gradle文件中。
You can open a new tab like this: 您可以像这样打开一个新标签:
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
CustomTabsIntent customTabsIntent = builder.build();
customTabsIntent.launchUrl(this, Uri.parse("https://www.example.com"));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.