【问题标题】:PlayerView custom controllsPlayerView 自定义控件
【发布时间】:2020-03-03 11:50:58
【问题描述】:

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

我的工作基于此:

Custom UI on exoplayer sample

还有这个:

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

我用一个自定义按钮在res/layout 中创建了custom_player_ui.xml(不是因为这个,我试图在没有这个的情况下进行构建)和标准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 编辑器和活动中一无所获。

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

【问题讨论】:

  • app:controller_layout_id="@layout/playback_control_view_mini" 试试这个

标签: android android-layout customization exoplayer


【解决方案1】:

也需要添加控件:

    <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" />

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多