のplsは、それはあなた
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:id="@+id/youtubeWebView"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</android.support.constraint.ConstraintLayout>
activity_main.xml
MainActivity.java
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebView;
public class MainActivity extends AppCompatActivity {
private WebView mWebview ;
private String youtubeUrl = "https://www.youtube.com/";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mWebview = (WebView) findViewById(R.id.youtubeWebView);
mWebview.loadUrl(youtubeUrl);
mWebview.getSettings().setJavaScriptEnabled(true);
}
}
のために動作します。このコードをフォロー
と、それは以下のPICで次のようになりますAndroidManifest.xmlをマニフェストファイル内
を
をインターネット許可を追加します。
![enter image description here](https://i.stack.imgur.com/E8ZcV.png)
私は、[Chromeカスタムタブ](https://developer.chrome.com/multidevice/android/customtabs)を使用することをお勧めします。あなたの場合、これはWebViewによく合い、そのパフォーマンスはもっと良くなります:)。これもあなたの問題を解決することを願っています! –
こんにちはミラ、あなたは以下の答えを試してみましたか?私は働いているコードとスクリーンショットの画像を共有しています、それは働いた – Thunder