views:

105

answers:

1

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

A: 

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

Chris L.
I thought layout_gravity was set to constants like Gravity.TOP, Gravity.LEFT etc. What does the value 1 mean?
Chris
Oh sorry, you're right. It's not layout_gravity. It's layout_weight
Chris L.