Поместите любой вид поверх VideoView в Android - PullRequest
9 голосов
/ 22 января 2010

Можно поставить любой вид поверх VideoView? (Т.е. наденьте кнопки управления на видео, как в Vimeo). Я пытаюсь сделать это, используя FrameLayout, но я не нашел пути, и я все еще не уверен, что то, что я пытаюсь сделать, просто невозможно.

1 Ответ

6 голосов
/ 22 января 2010

Я делаю такие вещи с FrameLayout. Что вам нужно сделать, это убедиться, что элементы управления находятся ниже VideoView в редакторе макетов.

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:background="@color/MenuTextNormal">

    <VideoView
        android:id="@+id/VideoView"
        android:layout_height="fill_parent"
        android:layout_width="fill_parent" />

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/ControlLayout"
        android:layout_gravity="bottom|center_horizontal">

        <Button
            android:text="@+id/Button01"
            android:id="@+id/Button01"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
        <Button
            android:text="@+id/Button02"
            android:id="@+id/Button02"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
        <Button
            android:text="@+id/Button03"
            android:id="@+id/Button03"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
        <Button
            android:text="@+id/Button04"
            android:id="@+id/Button04"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    </LinearLayout>
</FrameLayout>
...