【发布时间】:2021-08-16 12:29:56
【问题描述】:
我在我的 android 应用程序中显示带有 exoPlayer 的字幕。现在我想将字幕的位置从屏幕底部更改到顶部。我尝试setBottomPaddingFraction 或setPadding 到 subtitleView 但没有用。是否可以更改屏幕中的字幕位置?如果你的答案是肯定的,怎么做?
【问题讨论】:
标签: android exoplayer subtitle
我在我的 android 应用程序中显示带有 exoPlayer 的字幕。现在我想将字幕的位置从屏幕底部更改到顶部。我尝试setBottomPaddingFraction 或setPadding 到 subtitleView 但没有用。是否可以更改屏幕中的字幕位置?如果你的答案是肯定的,怎么做?
【问题讨论】:
标签: android exoplayer subtitle
我不确定这是否可行,但是您可以使用此侦听器获取 exoplayer 字幕并将其设置在您的 textView 中并将其放在您想要的任何位置:
player.addTextOutput(new TextOutput() {
@Override
public void onCues(List<Cue> cues) {
txtBottomSubtitle.setBackgroundColor(Color.TRANSPARENT);
txtBottomSubtitle.setText("");
if (cues.size() > 0) {
txtBottomSubtitle.setBackgroundColor(Color.parseColor("#80000000"));
htmlInTextView(txtBottomSubtitle, cues.get(0).text.toString());
}
}
});
【讨论】: