A (175)

(Tuis.) #1

292 CHAPTER 8: Android UI Design: Using Advanced ViewGroup Layout Containers


   Swap the order of the <LinearLayout> structures to put the planet information
pane as the top-most pane in the SlidingPaneLayout engine by copying
the <LinearLayout> and nested <ImageButton> tags to the top of the UI
design underneath the <SlidingPaneLayout> parent tag, which will swap the
ImageButton UI pane with the Planet Information Screen pane.
 Run the revised SlidingPaneLayout UI design adjustments in the Nexus One
AVD emulator to make sure that the panes have switched places in the final
sliding pane UI design.

Creating a SlidingPaneLayout: Revising the XML


What we want to do is to make the Galaxy Information Screen UI design that you created in Chapter 6
one of the SlidingPaneLayout UI panes, so we are going to put your existing
structure inside of this SlidingPaneLayout structure, which uses the parent tag from the android.v4
support package which uses the tag format:



You will insert this parent tag at the top of the activity_main.xml file.


Add the <android.support.v4.widget.SlidingPaneLayout> tag at the top of your activity_main.xml
file, and cut and paste the xmlns:android, xmlns:tools and tools:context parameters from the


parent layout container into the (now) SlidingPaneLayout parent container, and add
an spLayout ID, as shown in Figure 8-19.

Figure 8-19. Add a SlidingPaneLayout parent layout container on the outside of your current LinearLayout design

Free download pdf