java - 如何在 Exoplayer 的字幕视图中显示所需位置的文本
问题描述
我是安卓工作室的新手。我正在尝试自定义 exoplayer UI,并能够通过以下代码在我想要的位置显示播放器视图和播放控件。但字幕视图中的文本始终位于视口的底部。如何将字幕文本放置在所需位置,例如中心或字幕视图中的顶部?
我尝试过使用不同的xml布局,例如限制字幕视图的高度,但似乎字幕视图会占据播放器视图下方的所有空间。我还阅读了字幕视图类文档以找到实现所需的方法,但没有成功。提前感谢您的帮助。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:id="@+id/Navigator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Test1"
android:textAllCaps="false" />
<com.google.android.exoplayer2.ui.AspectRatioFrameLayout
android:id="@id/exo_content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="top|center">
<!-- Video surface will be inserted as the first child of the content
frame. -->
<View android:id="@id/exo_shutter"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"/>
<View
android:id="@id/exo_controller_placeholder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible" />
</com.google.android.exoplayer2.ui.AspectRatioFrameLayout>
<com.google.android.exoplayer2.ui.SubtitleView
android:id="@id/exo_subtitles"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white" />
</LinearLayout>
这是模拟器上播放器的截图:
解决方案
推荐阅读
- .htaccess - .htaccess 将嵌套目录转换为 URL 参数
- tensorflow - 如何使 yolo v3 中的边界框更紧(更靠近对象)?
- r - GROUP BY ... 在 dbplyr 中有
- java - 我在我的 android 项目中出现错误,并显示其他四个错误?
- laravel - 在laravel中检索日期之间的数据
- python - 如何爬取IMDB?[阅读更多] 按钮未按下
- python - ModuleNotFoundError:没有名为“intersys.pythonbind31”的模块
- kubernetes - 谷歌 Kubernetes 引擎节点空闲超时
- bash - 为什么每次重启都需要更新系统变量?
- .net - 无法创建虚拟目录。找不到 Web 服务器“http://localhost/foo”