views:

25

answers:

1

Consider a VideoView added to a Linear Layout with parameteres FILL_PARENT, FILL_PARENT.

The Linear Layout gets added to the root layout which is a Relative Layout, with parameters WRAP_CONTENT, WRAP_CONTENT.

Which parameters take precedence here?

A: 

I may be wrong, but this would result in your LinearLayout (and thus VideoView) having dimensions of [0,0].

VideoView gets added to LinearLayout but has to wait to set its size because it doesn't know how big its parent, LinearLayout, is. Thus its initial size would be [0,0]. Then your LinearLayout gets added to RelativeLayout, but since the parameter is WRAP_CONTENT and the content's size is [0,0], LinearLayout's size is also set to [0,0]. This in turn sets VideoView's size to [0,0].

Andy Zhang