George Yang
George Yang

Reputation: 704

What is the appropriate way to play a video in the background of an Android Activity (video as background view)

None of the existing tutorials I've found actually work. Anybody have suggestions on the correct implementation for this?

Upvotes: 0

Views: 1899

Answers (1)

rupesh jain
rupesh jain

Reputation: 3440

Have a FrameLayout with VideoView and the view which holds your content.Make the content view semi transparent.This way the video will play in background and the semi transparent content on top of it.

something like this:

 <FrameLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <VideoView
        android:id="@+id/progress_bar"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_gravity="center_horizontal|top" />
    <TextView
        android:background="#CCFF0000"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_gravity="center_horizontal|top"
      >
    </TextView>

</FrameLayout>

Let me know if this works for you

Upvotes: 4

Related Questions