【问题标题】:Exoplayer Controllers visibility cannot be handled programatically in Android在 Android 中无法以编程方式处理 Exoplayer 控制器的可见性
【发布时间】:2021-05-03 12:38:24
【问题描述】:

我使用 Exoplayer 的 PLayerView 播放视频。一切正常。我想在控制器布局中使用前进按钮/后退按钮。我使用了 exo_rew 和 exo_ffwd。但我无法更改 exo_rew、exo_ffwd 的可见性。我希望始终显示快退按钮,但有时仅显示前进按钮,具体取决于我的用例。

有人可以帮助我了解如何使用控制器的可见性。

【问题讨论】:

  • 你试过什么?贴出代码。

标签: android exoplayer google-developers-console


【解决方案1】:

首先为您的 exoplayer 设计自定义控件,然后将您的前进按钮放在任何布局中,例如 LinearLayout 现在您可以轻松隐藏按钮的可见性

<LinearLayout
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/exo_ffwd_control"
      android:orientation="vertical">
   <ImageButton
        android:id="@id/exo_ffwd"
        style="@style/ExoMediaButton.FastForward"
        android:tint="@color/colorPrimaryDark"
        android:tintMode="src_in" />
</LinearLayout>

    if(<your condition>){
         exo_ffwd_control.setVisibility(View.GONE);
    }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-19
    • 2018-01-31
    • 1970-01-01
    • 2016-06-15
    相关资源
    最近更新 更多