502 CHAPTER 13: Android Service Class and Threads: Background Processing
The next thing to do is change the configuration parameters, or attributes, of these
child tags to reduce the size of these icon graphics, as well as push them up into the corners of
the video.
This will allow more of the planet fly-over video to be seen, which will look more professional. The
progression of what you are about to do in the activity_play XML mark-up can be seen in the middle
and right panes of Figure 13-18. You will be using a couple of the layout parameters to downsample,
or resize in a downward direction, the audio icon image assets that you installed in the /res/
drawable-hdpi folder earlier in the chapter.
Let’s remove the padding and negative margin parameters and use a much more simple
android:layout_margin parameter with a value of 8dip to push the icons away from the edges
of the screen. To scale the icons down, you replace the wrap_content constant values in the
android:layout_width and android:layout_height parameters with DIP values. Initially, we will try a
setting of 100dip, the results of which are shown in the center pane of Figure 13-18. The new XML
mark-up should look like the following, as shown in Figure 13-19:
<ImageView android:id="@+id/playAudio" android:src="@drawable/sound1" android:layout_margin="4dip"
android:contentDescription="@string/play_audio" android:layout_width="60dp"
android:layout_height="60dp" />
<ImageView android:id="@+id/stopAudio" android:src="@drawable/sound0" android:layout_margin="4dip"
android:layout_alignParentTop="true" android:contentDescription="@string/play_audio"
android:layout_alignParentRight="true" android:layout_width="60dip" android:layout_height="60dip" />
Figure 13-19. Change the wrap_content values to DIP values and change the padding values to margin values
The icons were still too big for my taste, so I reduced 100dip to 60dip to scale the audio control
icons down some more, and I reduced 8dip to 4dip to pull the icons into the corners of the display
more, as shown on the right pane of Figure 13-18.