Reputation: 1162
i need to add View
over my TextureView
which play video in it
i used VideoView
before and it was totally fine but i had problem with animation so i changed it to TextureView
and now i can't put any View
over it!
seems that Textureview
will cover over all views
this is my xml layout :
<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>
How can i put a View
over TextureView
which is playing video?
Upvotes: 1
Views: 3628
Reputation: 1803
TextureView
that constantly updates its content (e.g. playing video) will always overdraw any View
content that is put on the top of it (e.g. TextureView
and some other View
puted inside FrameLayout
container).
The best solution I found to handle that is to show the top View
inside another Window
that sits on top of Window
that contains TextureView
, e.g. PopupWindow
can be used for that.
Upvotes: 0
Reputation: 1201
Perhaps you can try this api of TextureView:
TextureView.setOpaque(false);
Upvotes: 0
Reputation: 1162
finally i had to add it programmically to my FrameLayout
after initializing TextureView
and playing video!
@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);
}
Upvotes: 2