YouTube video playback stopped due to unauthorized overlay on top of player. The YouTubePlayerView is obscured by com.google.android.youtube.player.YouTubePlayerView{b5323ed V.E...... ........ 0,0-680,382}. YouTubePlayerView is completely covered, with the distance in px between each edge of the obscuring view and the YouTubePlayerView being: left: 0, top: 0, right: 0, bottom: 0..
我已经提到了上面的错误,当我使用新的YouTube视频网址重新初始化youtube片段时,我正面临这个错误。
到目前为止,我已经在youtube播放器上方使用了一个视图,并根据播放器状态将其设置为隐藏或可见,并且它首次正常工作但是当我使用新的youtube网址重新加载时,它在2秒后无法播放。
我发布了我的布局代码自爆
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent">
<FrameLayout
android:id="@+id/youtube_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/blue"
/>
<ImageView
android:layout_width="@dimen/dimen_size_40dp"
android:layout_height="@dimen/dimen_size_40dp"
android:layout_alignParentEnd="true"
android:scaleType="centerInside"
android:layout_gravity="end"
android:src="@drawable/ic_mode_edit_white_48" />
</RelativeLayout>
任何人都请让我知道我做错了什么?
答案 0 :(得分:0)
请勿在youtubeview或片段之上叠加任何视图。只需为您的imageview提供一些上边距,或者您可以在imageview标记内使用layout_below属性。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent">
<FrameLayout
android:id="@+id/youtube_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/blue"
/>
<ImageView
android:layout_width="@dimen/dimen_size_40dp"
android:layout_height="@dimen/dimen_size_40dp"
android:layout_alignParentEnd="true"
android:scaleType="centerInside"
android:layout_gravity="end"
android:layout_below="youtube_layout" // added this line
android:src="@drawable/ic_mode_edit_white_48" />