Поместите любой вид на видеопросмотр в Android

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


person abarcia    schedule 22.01.2010    source источник


Ответы (1)


Я делаю такие вещи с 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>
person CaseyB    schedule 22.01.2010
comment
И если я использую setZOrderOnTop(true) для VideoView, потому что это решение в соответствии с эта проблема, как тогда я могу поставить просмотры над ней? - person Eido95; 01.11.2016
comment
это правильно, setZOrderOnTop сделает VideoView над всем, так как это решить - person Muhammed Refaat; 28.01.2018