4

I want to play video in background of the view.In view i want to some other view like button and textview, can it is possible to do that? i have try using the following code <

RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <VideoView 
        android:scrollbars="none"
        android:clickable="false"
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"      
        android:fitsSystemWindows="true"
        android:id="@+id/VideoView">
        </VideoView>
<TextView 
    android:text="hi123"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
/>

</RelativeLayout>

Please suggest me how can it possible to do it.

Thank you.

Sameer Z.
  • 3,265
  • 9
  • 48
  • 72
  • If you have done with your code than please update it. I also need to do this task but I am not able to do from a long time. If you dont mine than please update your way / code over here . thanks – Akarsh M Feb 21 '14 at 13:10

2 Answers2

5

Not sure if you can put a videoView in background. The better option would be to use a frame layout with a transparent background and put your other views on the top of it.

Shafi
  • 1,368
  • 10
  • 24
  • thank for help,it is working but i have put the relative layout inside the framelayout then relative layout property not working like below/above etc,is there any way to do it? – Sameer Z. Aug 16 '11 at 09:35
  • Framelayout must not be an issue when merged with relativelayout. I have used it and it works fine for me. May be you can go through the attributes in your xml file once again to identify the issue. – Shafi Aug 16 '11 at 11:20
4

Shafi is right i m just posting code how i have done,

 <merge xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="fill_parent">
<VideoView  
        android:scrollbars="none"
        android:clickable="false"
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"      
        android:fitsSystemWindows="true"
        android:id="@+id/videoView"

         />.....

I hope this code will help some one. Thank you

Sameer Z.
  • 3,265
  • 9
  • 48
  • 72
  • 1
    Sameer, how does your java code for the video player look like? Can you share that? I am getting a pop message saying "Cant play the video". Then I get a black screen. – mcfred Sep 08 '17 at 15:29