Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Put ImageView exactly over VideoView

I need to put a ImageView exactly over a VideoView.
When I use this code in a RelativLayout

<VideoView
     android:id="@+id/videoView1"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:layout_alignParentTop="true"
     android:layout_alignParentLeft="true" />

<ImageView
     android:id="@+id/imageView1"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:layout_alignParentTop="true"
     android:layout_alignParentLeft="true" />

the VideoView is shown on the top, the ImageView is centered vertically. What can be done to also center the ImageView, that both Views are at the same position and have the same size, when a video and a picture with the same resolution are displayed?

like image 419
user2737037 Avatar asked Dec 05 '25 14:12

user2737037


2 Answers

I just replaced my RelativLayout with an FrameLayout and everything did well.

like image 141
user2737037 Avatar answered Dec 07 '25 04:12

user2737037


Place first videoview then imageview in framelayout, if you are still facing problem there might be..

videoView.setZOrderOnTop(true) set by you, so make it false or remove it.

like image 25
Rahul Jain Avatar answered Dec 07 '25 03:12

Rahul Jain



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!