在VideoView的MediaController定位VideoView、MediaController

2023-09-12 07:06:20 作者:痛楚

我有一个VideoView,占用了活动的上半部分的纵向与屏幕底部显示一些图像和文字的一半。我在视频查看播放RTSP视频流活动启动时。我已经通过以下code连着的MediaController到VideoView:

I have a VideoView that takes up the top half of the Activity in portrait orientation with the bottom half of the screen showing some images and text. I am playing a rtsp video stream in the video view when the Activity starts. I have attached a MediaController to the VideoView via the following code:

    MediaController controller = new MediaController(this);
    controller.setAnchorView(this.videoView);
    controller.setMediaPlayer(this.videoView);
    this.videoView.setMediaController(controller);

当我一敲VideoView弹出的MediaController在屏幕上我预计将出现播放控件覆盖在VideoView(中的MediaController的甚至与VideoView底部的底部)的底部区域。取而代之的是的MediaController弹出低了下去在屏幕上,覆盖了一些图形和文字我有VideoView下方。

When I tap the VideoView to bring up the MediaController on the screen I expected the playback controls to appear overlaying the bottom area of the VideoView (the bottom of the MediaController even with the bottom of the VideoView). Instead the MediaController pops up lower down on the screen, overlaying some of the graphics and text I have below the VideoView.

有没有我需要得到的MediaController出现,我希望它在屏幕上一些额外的步骤?

Are there some additional steps I need to take to get the MediaController to appear where I want it to on the screen?

推荐答案

坦率地说,我只是写我自己的控制器。事实上,我做了一次的。

Frankly, I'd just write my own controller. In fact, I did once.

话虽这么说,试试 setAnchorView() - 我的阅读源$ C ​​$ C时,的MediaController 将出现在底部任何的锚观点。

That being said, try setAnchorView() -- by my reading of the source code, the MediaController will appear at the bottom of whatever the anchor view is.

 
精彩推荐