Android VideoView 方向更改
我的 Android 应用程序上有一个 VideoView
正在播放视频。当我在纵向上尝试时,视频充满了屏幕。但是当我将方向更改为横向时,视频只占用一半的屏幕空间。我使用 FILL_PARENT
、FILL_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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果它在纵向模式下完美地填满屏幕,如何在不改变宽高比的情况下完美地适应横向模式?
反之亦然 - 如果它完全适合横向模式,那么当您更改为纵向时,它不会占用所有垂直空间。
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.
您的视频可能太小了。您可以将其置于父级中心以使其看起来更好。或者尝试向您的提供商请求更大的视频。
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.
您可以考虑为纵向和横向视图制作两种不同的布局。
假设您有“/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