簡體   English   中英

我想使用內置的 Android 系統 web 視圖打開一個 url,如下圖所示

[英]I want to open a url using inbuilt Android system web view like the below image

圖片在這里

我想在不離開我的應用程序的情況下打開網頁

任何答案都非常感謝

要在 webview 中打開一個 url,只需將 WebView 添加到您的 xml 中。 然后這樣做。

webView = (WebView) findViewById(R.id.webView1);
        webView.getSettings().setJavaScriptEnabled(true);
        webView.loadUrl("http://www.google.com");

不過,您上面的圖像是 chromecustomtab。 所以要做到這一點,你想把它添加到你的應用程序級 build.gradle

compile 'com.android.support:customtabs:23.3.0'

然后打開一個這樣的網址:

String url = ¨https://paul.kinlan.me/¨;
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
CustomTabsIntent customTabsIntent = builder.build();
customTabsIntent.launchUrl(this, Uri.parse(url));

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM