如何在此类网页浏览中打开链接
而不是手机安装浏览器?
修改
使用此代码无效:
public class WebsiteActivity extends AppCompatActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WebView webView = new WebView(this);
setContentView(webView);
webView.loadUrl("http://www.google.com");
编辑2
使用上面的代码将导致:
但我想要这个:
答案 0 :(得分:1)
在build.gradle文件中添加
dependencies {
...
compile 'com.android.support:customtabs:23.3.0'
}
打开Chrome自定义标签
// Use a CustomTabsIntent.Builder to configure CustomTabsIntent.
// Once ready, call CustomTabsIntent.Builder.build() to create a CustomTabsIntent
// and launch the desired Url with CustomTabsIntent.launchUrl()
String url = ¨https://paul.kinlan.me/¨;
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
CustomTabsIntent customTabsIntent = builder.build() ;
customTabsIntent.launchUrl(this, Uri.parse(url));