Android VideoView LinearLayout 布局参数
我的应用程序使用 VideoView 播放视频。我正在使用 LinearLayout 添加一些文本、视频和一些按钮。
我的问题是我可以为 VideoView 使用什么样的布局参数来确保它在所有手机上都能正常播放?基本上,在纵向模式下,我希望使用完整的宽度,并使用视频的高度。在横向时,我希望它看起来更像全屏模式。
我注意到这个设置在 myTouch 上适用于纵向和横向,
new LinearLayout.LayoutParams( LayoutParams.FILL_PARENT,480);
并且,这适用于 Droid 的纵向和横向,
new LinearLayout.LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
谢谢 克里斯
My app plays a video using VideoView. I am using a LinearLayout to add some text, the video and then some buttons.
My question is what kind of layout params can I use for the VideoView to make sure it plays well in all phones? Basically, when in portrait mode, I want the complete width to be used, and video height to be used. When in landscape, I would like it to look more like the full screen mode.
I have noticed that this setting works well on myTouch for both portrait and landscape,
new LinearLayout.LayoutParams( LayoutParams.FILL_PARENT,480);
and, this works on Droid for both portrait and landscape,
new LinearLayout.LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
Thanks
Chris
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
让它填满所有可用空间。
VideoView
将缩放视频以利用您提供的任何空间。Have it fill all available space.
VideoView
will scale the video to take advantage of whatever room you give it.