2016-09-15 1 views
-1

は、どのように私はWebViewの代わりに電話インストールされたブラウザの新しいSystem WebViewを使用していますか?

System Webview

のこの種でリンクを開くことができますか?このコードを使用

Chrome browser

EDIT

は働かない:上記のコードを使用して

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"); 

EDIT 2

このもたらす:

Inside app

しかし、私はこれ欲しい:

System webview

+1

オムをクロームカスタムタブを開くと、あなたのbuild.gradleファイル

dependencies { ... compile 'com.android.support:customtabs:23.3.0' } 

でこれを追加し、それはちょうど[ 'WebViewのです'](https://developer.android.com/reference/android/webkit/WebView.html)。レンダリングエンジンはPlayストア経由で更新できるようになりましたが、開発者の立場からはまだ 'WebView'です。 – CommonsWare

+0

@CommonsWareそれは動作しません、私は質問を更新しました – Eric

+0

あなたが 'インターネット '権限を持っていることを確認してください。また、 'WebView'でJavaScriptを有効にしていないので、JavaScript(例えば、' https:// commonsware.com')を必要としないURLを試してください。それを超えて、**詳細に**を説明してください、それは "うまくいかない"ということを意味します。 [サンプルアプリケーションはこちらです(https://github.com/commonsguy/cw-omnibus/tree/v7.6/WebKit/Browser1)。これは 'WebView'の使用方法を示しています。 – CommonsWare

答えて

1

// 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)); 
+0

正確に私が必要とした;) – Eric

関連する問題