开发者

Android VideoView orientation change

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 or开发者_开发百科ientations?


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜