2016-04-05 27 views
0

在我的情況下,在youtube播放器視圖的上方設置textview。我收到錯誤,如未經授權的覆蓋。是否有可能覆蓋在youtube播放器視圖中的視圖?下面是否有可能將覆蓋視圖放置在android的YouTube播放器視圖中?

是我的代碼

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

回答

0

嘗試添加YouTube播放器,並和文本視圖中的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()有可能錯誤,但我相信可以解決這些問題

希望這將有助於你

+0

感謝您的答覆,但它不是在工作的我case.please看到我編輯的問題,我得到的錯誤liike YouTube視頻播放停止由於未經授權的覆蓋播放器頂部。 YouTubePlayerView被android.widget.TextView遮擋了{1ba6139 V.ED .... ........ 0,200-240,270#7f060002 app:id/txt_attach}。該視圖位於YouTubePlayerView內部,模糊視圖的每個邊緣與YouTubePlayerView之間的距離爲:left:0,top:100,right:480,bottom:235 .. – Rajesh

+0

您需要檢查@sebastiano答案 http://stackoverflow.com/a/31695617/3593066希望這會幫助你。因爲我現在不能測試這些東西,但後來我會測試並且會讓你知道 –

相關問題