答案 0 :(得分:0)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:orientation="vertical"
android:fitsSystemWindows="true"
tools:context="it.tranvantung.stackoverflow.MainActivity">
<fr.bmartel.youtubetv.YoutubeTvView
android:id="@+id/youtube_video"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:yt_autoplay="true"
app:yt_videoId="kjkTvbYvglQ" />
</LinearLayout>
WebView
获取YoutubeTvView
并停用触摸功能。
YoutubeTvView youtubeTvView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
youtubeTvView = findViewById(R.id.youtube_video);
WebView youtubeWebview = youtubeTvView.findViewById(R.id.youtube_view);
youtubeWebview.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return true;
}
});
}
android:hardwareAccelerated="true"
<activity android:name=".MainActivity"
android:hardwareAccelerated="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
compile 'fr.bmartel:youtubetv:1.2'