Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2d9063bc authored by Scott Main's avatar Scott Main
Browse files

docs: Add a few links and small edits to a couple layout guides

Change-Id: I4c0c043782524a29f7fb8fcb54cc26d7399c39fc
parent 9047e466
Loading
Loading
Loading
Loading
+11 −15
Original line number Diff line number Diff line
@@ -32,12 +32,17 @@ parent.link=index.html
    <li>{@link android.view.ViewGroup}</li>
    <li>{@link android.view.ViewGroup.LayoutParams}</li>
  </ol>
</div>
  
  <h2>See also</h2>
  <ol>
    <li><a href="{@docRoot}training/basics/firstapp/building-ui.html">Building a Simple User
Interface</a></li> </div>
</div>

<p>Your layout is the architecture for the user interface in an Activity.
It defines the layout structure and holds all the elements that appear to the user. 
You can declare your layout in two ways:</p>
<p>A layout defines the visual structure for a user interface, such as the UI for an <a
href="{@docRoot}guide/components/activities.html">activity</a> or <a
href="{@docRoot}guide/topics/appwidgets/index.html">app widget</a>.
You can declare a layout in two ways:</p>
<ul>
<li><strong>Declare UI elements in XML</strong>. Android provides a straightforward XML 
vocabulary that corresponds to the View classes and subclasses, such as those for widgets and layouts.</li>
@@ -77,16 +82,6 @@ Layout Objects</a>. There are also a collection of tutorials on building various

<h2 id="write">Write the XML</h2>

<div class="sidebox-wrapper">
<div class="sidebox">
<p>For your convenience, the API reference documentation for UI related classes
lists the available XML attributes that correspond to the class methods, including inherited
attributes.</p>
<p>To learn more about the available XML elements and attributes, as well as the format of the XML file, see <a
href="{@docRoot}guide/topics/resources/available-resources.html#layoutresources">Layout Resources</a>.</p>
</div>
</div>

<p>Using Android's XML vocabulary, you can quickly design UI layouts and the screen elements they contain, in the same way you create web pages in HTML &mdash; with a series of nested elements. </p>

<p>Each layout file must contain exactly one root element, which must be a View or ViewGroup object. Once you've defined the root element, you can add additional layout objects or widgets as child elements to gradually build a View hierarchy that defines your layout. For example, here's an XML layout that uses a vertical {@link android.widget.LinearLayout}
@@ -111,7 +106,8 @@ to hold a {@link android.widget.TextView} and a {@link android.widget.Button}:</
<p>After you've declared your layout in XML, save the file with the <code>.xml</code> extension, 
in your Android project's <code>res/layout/</code> directory, so it will properly compile. </p>

<p>We'll discuss each of the attributes shown here a little later.</p>
<p>More information about the syntax for a layout XML file is available in the <a
href="{@docRoot}guide/topics/resources/layout-resource.html">Layout Resources</a> document.</p>

<h2 id="load">Load the XML Resource</h2>

+5 −0
Original line number Diff line number Diff line
@@ -22,10 +22,15 @@ two-dimensional,
scrollable grid. The grid items are automatically inserted to the layout using a {@link
android.widget.ListAdapter}.</p>

<p>For an introduction to how you can dynamically insert views using an adapter, read
<a href="{@docRoot}guide/topics/ui/declaring-layout.html#AdapterViews">Building Layouts with
  an Adapter</a>.</p>

<img src="{@docRoot}images/ui/gridview.png" alt="" />


<h2 id="example">Example</h2>

<p>In this tutorial, you'll create a grid of image thumbnails. When an item is selected, a
toast message will display the position of the image.</p>

+5 −1
Original line number Diff line number Diff line
@@ -28,6 +28,10 @@ scrollable items. The list items are automatically inserted to the list using an
android.widget.Adapter} that pulls content from a source such as an array or database query and
converts each item result into a view that's placed into the list.</p>

<p>For an introduction to how you can dynamically insert views using an adapter, read
<a href="{@docRoot}guide/topics/ui/declaring-layout.html#AdapterViews">Building Layouts with
  an Adapter</a>.</p>

<img src="{@docRoot}images/ui/listview.png" alt="" />

<h2 id="Loader">Using a Loader</h2>
@@ -147,5 +151,5 @@ href="{@docRoot}guide/topics/providers/contacts-provider.html">Contacts
Provider</a>, if you want to
try this code, your app must request the {@link android.Manifest.permission#READ_CONTACTS}
permission in the manifest file:<br/>
<code>&lt;uses-permission android:name="android.permission.READ_CONTACTS" /></p>
<code>&lt;uses-permission android:name="android.permission.READ_CONTACTS" /></code></p>