436 CHAPTER 11: Digital Video: Streaming Video, MediaPlayer, and MediaController classes
What this means is that a FrameLayout container doesn’t scale or otherwise alter what is inside of
its container, which stands to reason, as it’s the intent of this UI container type to frame or display a
fixed result on the screen.
There is a way around this, a trick which I will be showing to you in a future section of this chapter,
after I show you how to center this fixed aspect ratio digital video asset.
Let’s get some hands-on experience with the one layout parameter which is supported by the
FrameLayout class, the android:layout_gravity parameter. Next, we will take a look at how to make
your current UI design look more professional, by centering the digital video asset inside of the
display screen. If the user’s display screen (device) size or shape changes across (between) devices,
your video will stay attractively centered!
Positioning a Video Asset Using layout_gravity
Add a line of space under your layout_height parameter in your
activity_play.xml file (tab) in Eclipse ADT, and add an android:layout_gravity="center" parameter,
as shown in Figure 11-31.
Figure 11-30. Test the VideoView and FrameLayout in the Nexus One (left and center) and layout_gravity (right)