我需要在我的TextureView上添加TextureView,在其中播放视频,我以前使用过VideoView,它是完全好的,但我有问题的动画,所以我把它改为TextureView,现在我不能把任何View在它上面!似乎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>如何将View放在播放视频的TextureView上?
发布于 2016-07-12 22:19:47
最后,在初始化FrameLayout和播放视频之后,我不得不编程地将它添加到我的TextureView中!
@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);
}发布于 2016-07-22 11:36:54
也许您可以尝试一下TextureView的api:
TextureView.setOpaque(假);
发布于 2021-02-11 14:46:12
不断更新其内容(例如播放视频)的TextureView总是会透支放置在其顶部的任何View内容(例如,TextureView和其他在FrameLayout容器中插入的View )。
我发现处理的最佳解决方案是在位于包含View的Window之上的另一个Window中显示顶部的TextureView,例如,可以使用PopupWindow。
https://stackoverflow.com/questions/38339131
复制相似问题