Android VideoView 方向更改

发布于 2024-09-02 00:48:54 字数 191 浏览 2 评论 0原文

我的 Android 应用程序上有一个 VideoView 正在播放视频。当我在纵向上尝试时,视频充满了屏幕。但是当我将方向更改为横向时,视频只占用一半的屏幕空间。我使用 FILL_PARENTFILL_PARENT 作为布局参数。

有没有办法让视频在两个方向上填满屏幕?

I am having a VideoView playing video on my Android app. When I try it on the portrait orientation, the video fills the screen. But when I change the orientation to landscape, the video takes up only half the screen space. I am using FILL_PARENT, FILL_PARENT as the layout parameters.

Is there a way I can have the video fill the screen in both orientations?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

拥抱影子 2024-09-09 00:48:54

如果它在纵向模式下完美地填满屏幕,如何在不改变宽高比的情况下完美地适应横向模式?

反之亦然 - 如果它完全适合横向模式,那么当您更改为纵向时,它不会占用所有垂直空间。

If it fills the screen perfectly in portrait mode how will it ever fit perfectly in landscape mode without changing the aspect ratio?

The same goes for the reverse - if it fits perfectly in landscape mode, when you change to portrait it won't take up all the vertical space.

小苏打饼 2024-09-09 00:48:54

您的视频可能太小了。您可以将其置于父级中心以使其看起来更好。或者尝试向您的提供商请求更大的视频。

Your video might be just too small. You can center it in parent to make it look better. Or try to request bigger video from your provider.

ˇ宁静的妩媚 2024-09-09 00:48:54

您可以考虑为纵向和横向视图制作两种不同的布局。
假设您有“/res/layout/main.xml”文件。在“/res/”文件夹中创建一个子文件夹并将其命名为“layout-land”,R文件将自动生成!
这是一个快照,只是为了让它更容易...

替代文本http://img826。 imageshack.us/img826/5749/previewu.png

之后您可以独立编辑每个布局...
当涉及到布局时,这是处理方向变化的最常见方法。

最好的问候,

伊戈尔

You might consider making two different layouts for portrait and landscape views.
Let's assume you have "/res/layout/main.xml" file. In the "/res/" folder make a child folder and name it "layout-land", the R file is going to be automatically generated!
Here is a snapshot just to make it easier...

alt text http://img826.imageshack.us/img826/5749/previewu.png

after you can edit each layout independently...
This is the most common way of working with orientation change, when it comes to layouts.

Best regards,

Igor

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文