是否可以在Android的youtube播放器视图中放置叠加视图? [英] Is it possible to place the overlay view in youtube player view in android?

查看:118
本文介绍了是否可以在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

希望对您有帮助

这篇关于是否可以在Android的youtube播放器视图中放置叠加视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆