android: video as background view

守給你的承諾、 提交于 2019-12-21 21:27:43

问题


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.


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/7074600/android-video-as-background-view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!