Android VideoView LinearLayout 布局参数

发布于 2024-09-08 00:49:34 字数 418 浏览 0 评论 0原文

我的应用程序使用 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 技术交流群。

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

发布评论

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

评论(1

你的呼吸 2024-09-15 00:49:34

我的问题是什么样的布局
我可以将参数用于 VideoView
确保它在所有手机上都能正常播放?

让它填满所有可用空间。 VideoView 将缩放视频以利用您提供的任何空间。

My question is what kind of layout
params can I use for the VideoView to
make sure it plays well in all phones?

Have it fill all available space. VideoView will scale the video to take advantage of whatever room you give it.

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