CHAPTER 8: Android UI Design: Using Advanced ViewGroup Layout Containers 299
during this chapter, and which we will refine further, along with finishing the Java code for this
SlidingPaneLayout UI design, in the next chapter.
The difference between defining the android:layout_width using an Android OS constant and using a
fixed DIP value is shown on the left and right sides of Figure 8 -2 8 , respectively. As you will see when you
play around with the XML markup a bit, the fixed DIP android:layout_width value allows you to constrain
exactly how far the content pane will slide to the right and how much of the UI pane it will reveal.
Figure 8-28. Test the UI design in the Nexus One AVD with layout_width as match_parent and as 110 DIP (right)
I determined a DIP setting that would show the ImageButton UI elements and leave an even amount
of margin around them, giving the most professional visual result with the basic ImageButton
parameter configuration. We will be changing and enhancing the ImageButton in the next chapter.
As you can see, we’re currently using this UI widget simply to display an image on top of a button
element. As you’ll soon see, it can do much more!
Summary
In this eighth chapter, you learned about some more advanced Android 4.0 layout container classes,
including the GridLayout class and the SlidingPaneLayout class. You learned about how the
“engines,” or algorithms, behind these classes work, and what parameters you need to use in your
child UI widgets to harness this power.