PlayerView自定义控件

问题描述 投票:0回答:1

我正在尝试为我的exoplayer设置自定义控件。

我的工作基于此:

Custom UI on exoplayer sample

和此:

https://exoplayer.dev/ui-components.html

我用一个自定义按钮在custom_player_ui.xml中创建了res/layout(不是因为这个,我试图在没有此按钮的情况下进行构建),并且标准ID像这样:

<ImageButton
       android:id="@+id/exo_fullscreen"
       style="@style/ExoMediaButton"
       android:src="@drawable/expandexo"
       android:tint="@color/colorPrimary"
       android:tintMode="src_in" />
<ImageButton
        android:id="@id/exo_prev"
        style="@style/ExoMediaButton.Previous"
        android:tint="@color/colorPrimary"
        android:tintMode="src_in" />

并在我的PlayerView中定义它:

<com.google.android.exoplayer2.ui.PlayerView
    android:id="@+id/player_view_channels"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:use_controller="false"
    android:layout_centerVertical="true"
    android:visibility="visible"
    app:rewind_increment="10000"
    app:fastforward_increment="10000"
    android:background="#000"
    app:show_timeout="1000"
    app:resize_mode="fit"
    app:controller_layout_id="@layout/custom_player_ui" />

但是我在xml编辑器和活动中什么也没得到。

显示我的控件还必须做些什么?

android android-layout customization exoplayer
1个回答
0
投票

也需要添加控件:

    <com.google.android.exoplayer2.ui.PlayerControlView
        android:id="@+id/controls"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        app:show_timeout="0" />
© www.soinside.com 2019 - 2024. All rights reserved.