是否可以在Android的youtube播放器视图中放置叠加视图?

问题描述:

在我的情况下,请在youtube播放器视图上方设置textview.我遇到类似未授权覆盖的错误.是否可以在youtube播放器视图中覆盖视图?

In my case,set the textview in above of the youtube player view.I am getting the error like unauthorized overlay.Is it possible to overlay the view in youtube player view?

下面是我的代码

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">


    <TextView
        android:id="@+id/txt_attach"
        android:layout_width="120dp"
        android:layout_height="35dp"
        android:gravity="center"
        android:textSize="15dp"
        android:textColor="#ffffff"
        android:layout_marginTop="100dp"


        android:visibility="visible"
        android:text="Attach"/>

  <fragment
      android:id="@+id/player_fragment"
      android:name="com.google.android.youtube.player.YouTubePlayerFragment"
      android:layout_width="wrap_content"
      android:layout_marginTop="50dp"
      android:layout_height="wrap_content"
     />


</FrameLayout>

尝试在框架布局中添加youtube播放器和文本视图.

try to add youtube player and and text view in framelayout.

<FrameLayout
   android:layout_width="wrap_content"
   android:layout_height="wrap_content">

   <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/text"
      android:padding="@dimen/four_dp"
      android:Text="text view" />

  <YouTubePlayer
      android:id="@+id/player"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" />

在您的活动中获取视图并调用text.bringToFront()可能存在错误,但我确定可以解决这些问题

and in you activity get the view and call text.bringToFront() there maybe errors but i am sure can resolve them

希望对您有帮助