LinearLayout We will kick start the learning journey of building Android UIs with a layout called GridView LinearLayout. Open the "activity_main.xml" is the layout file for UI, follow MainActivity's these steps diligently and you will pick up valuable learning points along the way: Switch to view (bottom left of Figure 9), then change the Text default to and delete the RelativeLayout LinearLayout default block from the XML page. TextView Switch to view, you should now see the layout appear Design LinearLayout under the node of the pane. Highlight Device Screen Component Tree this node, then locate the property in LinearLayout orientation the pane below the pane, click and set it Properties Component Tree to horizontal. Drag and drop a control from the palette onto the virtual Button Widgets device's screen. The control is also appeared under Button the node of the pane. (Figure 12) Device Screen Component Tree Figure 12: Drag and Drop a Button control Continue to add one more controls from the palette onto the Button Widgets virtual device's screen. The two buttons will be placed side by side horizontally (Figure 13). Figure 13: LinearLayout with two Button Controls Learning Point 1: The (color, size, margin, padding, weight, etc) of each UI component can state be altered through their You can see a complete list of properties properties. pertaining to a particular UI component on the pane (bottom right) in Properties
LinearLayout We will kick start the learning journey of building Android UIs with a GridView layout called LinearLayout. Open the "activity_main.xml" is the layout file for MainActivity's UI, follow these steps diligently and you will pick up valuable learning points along the way: Switch to Text view (bottom left of Figure 9), then change the default RelativeLayout to LinearLayout and delete the default TextView block from the XML page. Switch to Design view, you should now see the LinearLayout layout appear under the Device Screen node of the Component Tree pane. Highlight this LinearLayout node, then locate the orientation property in the Properties pane below the Component Tree pane, click and set it to horizontal. Drag and drop a Button control from the Widgets palette onto the virtual device's screen. The Button control is also appeared under the Device Screen node of the Component Tree pane. (Figure 12) Figure 12: Drag and Drop a Button control Continue to add one more Button controls from the Widgets palette onto the virtual device's screen. The two buttons will be placed side by side horizontally (Figure 13). Figure 13: LinearLayout with two Button Controls Learning Point 1: The state (color, size, margin, padding, weight, etc) of each UI component can be altered through their properties. You can see a complete list of properties pertaining to a particular UI component on the Properties pane (bottom right) in
Android%20UI%20and%20Controls%20New.docx