Changes

An Android 6 TableLayout and TableRow Tutorial

18 bytes added, 19:56, 27 October 2016
m
Text replacement - "<table border="0" cellspacing="0">" to "<table border="0" cellspacing="0" width="100%">"
<googlehtmlet>BUY_ANDROID_STUDIO6androidstudio_a6</googlehtmlet>
Locate the activity_database.xml file in the Project tool window (app -> res -> layout) and double click on it to load it into the Designer tool. By default, Android Studio has used a RelativeLayout as the root layout element in the user interface. This needs to be replaced by a vertically oriented LinearLayout. With the Designer tool in Text mode, replace the XML with the following:
<googlehtmlet>BUY_ANDROID_STUDIO6androidstudio_a6</googlehtmlet>
<pre>
<?xml version="1.0" encoding="utf-8"?>
== Adding and Configuring the TableRows ==
<googlehtmlet>ADSDAQBOX_FLOWadsdaqbox_flow</googlehtmlet>
Now that the TableLayout has been added to the user interface layout, three TableRow instances need to be added as children. From the Designer palette, locate the TableRow entry listed under Layouts and drag and drop an instance directly onto the top of the TableLayout entry in the Component Tree panel. Repeat this step to add two more TableRows so that the component tree matches Figure 47-5:
Figure 47-7
<googlehtmlet>BUY_ANDROID_STUDIO6androidstudio_a6</googlehtmlet>
Before proceeding, also check the hierarchy of the layout in the Component Tree panel, taking extra care to ensure the view ID names match those in the following figure:
<googlehtmlet>BUY_ANDROID_STUDIO6androidstudio_a6</googlehtmlet>
 
<htmlet>ezoicbottom</htmlet>
<hr>
<table border="0" cellspacing="0" width="100%">