Android 如何在TextureView上添加视图

Android 如何在TextureView上添加视图,android,android-layout,android-videoview,textureview,android-textureview,Android,Android Layout,Android Videoview,Textureview,Android Textureview,我需要在我的TextureView上添加View,在其中播放视频 我以前使用过VideoView,它完全没问题,但我在动画方面遇到了问题,所以我把它改成了TextureView,现在我不能在上面放任何视图了! 似乎Textureview将覆盖所有视图 这是我的xml布局: <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id

我需要在我的
TextureView
上添加
View
,在其中播放视频 我以前使用过
VideoView
,它完全没问题,但我在动画方面遇到了问题,所以我把它改成了
TextureView
,现在我不能在上面放任何
视图了!
似乎
Textureview
将覆盖所有视图 这是我的xml布局:

  <FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/frmview"
    >

    <com.my.app.TextureVideoView
        android:id="@+id/vv_play"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:alpha="0.0" />

    <ImageView
        android:id="@+id/iv_play"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:srcCompat="@drawable/app_ic" />
</FrameLayout>


如何将
视图
放在播放视频的
纹理视图
上?

最后,在初始化
纹理视图
并播放视频后,我必须以编程方式将其添加到我的
框架布局中

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);

    mPreview = (TextureView) findViewById(R.id.vv_play);
    mPreview.setSurfaceTextureListener(this);
    FrameLayout frameLayout = (FrameLayout) findViewById(R.id.frmview);

    ImageView img = new ImageView(this);
    img.setImageResource(R.drawable.app_ic);
    frameLayout.addView(img);
}

也许您可以尝试以下TextureView api:


TextureView.Set不透明(假)

TextureView
不断更新其内容(例如播放视频)将始终透支放在其顶部的任何
视图
内容(例如
TextureView
和放在
FrameLayout
容器中的其他一些
视图

我找到的最佳解决方案是在另一个
窗口中显示顶部
视图
,该窗口位于包含
纹理视图的
窗口
的顶部,例如可以使用
弹出窗口