文本视图和视频视图
我在 LinearLayout 中有一个 TextView ,在 LinearLayout 中有一个 VideoView 。
父布局是一个RelativeLayout,它包括TextView的线性布局和VideoView的线性布局。
由于我使用 FILL_PARENT、FILL_PARENT 参数添加 VideoView(因为我希望它以横向模式填充屏幕),因此在某些手机中,当我旋转到横向时,VideoView 会填充整个屏幕,而 TextView 不可见。
这种情况仅发生在某些手机上,并且仅在横向模式下发生。
我尝试为 VideoView 的线性布局设置顶部填充,但看起来不同手机的填充应该不同。例如:顶部填充 10 适用于 myTouch,但不适用于 Droid。
有什么想法吗?
谢谢 克里斯
I have a TextView inside a LinearLayout and a VideoView inside a LinearLayout.
The parent layout is a RelativeLayout that includes the TextView's linear layout and VideoView's linear layout.
Since I add the VideoView with FILL_PARENT, FILL_PARENT params (coz I want it to fill the screen in landscape mode), in some phones when I rotate to landscape, the VideoView fills the entire screen, and the TextView is not visible.
This happens only in certain phones, and only in landscape mode.
I have tried setting a top padding for the VideoView's linear layout, but it looks like the padding should be different for different phones. For eg: a top padding of 10 works on a myTouch but not on Droid.
Any ideas?
Thanks
Chris
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 WRAP_CONTENT,然后设置 android:layout_gravity,而不是使用 FILL_PARENT。如果将 VideoView 上的 android:layout_gravity 设置为 1 并且不设置 TextView 的 android:layout_gravity 那么它将在正确的高度显示 TextView,然后用 VideoView 填充其余部分。如果你展示你的布局 xml,我可以给你一个更具体的例子。
-- 编辑:我的错,我的意思是layout_weight
Instead of using FILL_PARENT you can use WRAP_CONTENT and then set the android:layout_gravity. If you set the android:layout_gravity on the VideoView to 1 and don't set the android:layout_gravity of the TextView then it will show the TextView at it's correct height and then fill the rest with the VideoView. If you show your layout xml I can give you a more specific example.
-- Edit: My bad I meant layout_weight