Is it possible to place the overlay view in youtube player view in android?

孤人 提交于 2019-12-11 16:50:02

问题


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?

below is my code

<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>

回答1:


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" />

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

hope that will help you



来源:https://stackoverflow.com/questions/36424468/is-it-possible-to-place-the-overlay-view-in-youtube-player-view-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!