• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1page.title=Android Developer Tools
2@jd:body
3
4  <div id="qv-wrapper">
5    <div id="qv">
6      <h2>In this document</h2>
7
8      <ol>
9        <li><a href="#tools">SDK Tools Integration</a></li>
10
11        <li><a href="#editors">Code Editors</a>
12          <ol>
13            <li><a href="#resource-linking">Resource linking enhancements</a></li>
14          </ol>
15        </li>
16
17        <li><a href="#graphical-editor">Graphical Layout Editor</a>
18          <ol>
19            <li><a href="#canvas">Canvas and outline view</a></li>
20            <li><a href="#palette">Palette</a></li>
21            <li><a href="#config-chooser">Configuration chooser</a></li>
22          </ol>
23        </li>
24
25        <li><a href="#refactoring">Layout Factoring Support</a></li>
26
27      </ol>
28
29      <h2>Related videos</h2>
30
31      <ol>
32        <li><a href="{@docRoot}videos/index.html#v=Oq05KqjXTvs">Android Developer Tools
33            Google I/O Session</a>
34        </li>
35      </ol>
36
37      <h2>See also</h2>
38
39      <ol>
40        <li><a href="http://tools.android.com/recent">Android Tools change blog</a></li>
41      </ol>
42    </div>
43  </div>
44
45  <p>ADT (Android Developer Tools) is a plugin for Eclipse that provides a suite of
46  tools that are integrated with the Eclipse IDE. It offers you access to many features that help
47  you develop Android applications quickly. ADT
48  provides GUI access to many of the command line SDK tools as well as a UI design tool for rapid
49  prototyping, designing, and building of your application's user interface.</p>
50
51  <p>Because ADT is a plugin for Eclipse, you get the functionality of a well-established IDE,
52  along with Android-specific features that are bundled with ADT. The following
53  describes important features of Eclipse and ADT:</p>
54
55  <dl>
56    <dt><strong>Integrated Android project creation, building, packaging, installation, and
57    debugging</strong></dt>
58
59    <dd>ADT integrates many development workflow tasks into Eclipse, making it easy for you to
60    rapidly develop and test your Android applications.</dd>
61
62    <dt><strong>SDK Tools integration</strong></dt>
63
64    <dd>Many of the <a href="#tools">SDK tools</a> are integrated into Eclipse's menus,
65    perspectives, or as a part of background processes ran by ADT.</dd>
66
67    <dt><strong>Java programming language and XML editors</strong></dt>
68
69    <dd>The Java programming language editor contains common IDE features such as compile time
70    syntax checking, auto-completion, and integrated documentation for the Android framework APIs.
71    ADT also provides custom XML editors that let you
72    edit Android-specific XML files in a form-based UI. A graphical layout editor lets you design
73    user interfaces with a drag and drop interface.</dd>
74
75    <dt><strong>Integrated documentation for Android framework APIs</strong></dt>
76    <dd>You can access documentation by hovering over classes, methods, or variables.</dd>
77  </dl>
78
79  <p>You can find the most up-to-date and more detailed information about changes and new features
80on the <a  href="http://tools.android.com/recent">Recent Changes</a> page at the Android  Tools
81Project site.</p>
82
83  <h2 id="tools">SDK Tools Integration</h2>
84
85  <div class="sidebox-wrapper">
86    <div class="sidebox">
87      <h2>Need help designing icons?</h2>
88  <p>The <a href="http://android-ui-utils.googlecode.com/hg/asset-studio/dist/index.html">Android
89      Asset Studio</a> is a web-based tool that lets you generate icons from existing images,
90    clipart, or text. It also generates the icons with different DPIs for different screen sizes and
91    types.</p>
92
93    </div>
94  </div>
95
96  <p>Many of the tools that you can start or run from the command line are integrated into ADT.
97  They include:</p>
98
99  <ul>
100    <li><a href="{@docRoot}tools/debugging/debugging-tracing.html">Traceview</a>:
101    Allows you to profile your program's execution
102    (<strong>Window &gt; Open Perspective &gt; Traceview</strong>). </li>
103
104    <li><a href="{@docRoot}tools/help/android.html">android</a>: Provides access to
105    the Android SDK Manager and AVD Manager. Other <code>android</code> features such as creating or
106    updating projects (application and library) are integrated throughout the Eclipse IDE. </li>
107
108    <li><a href="{@docRoot}tools/debugging/debugging-ui.html#HierarchyViewer">Hierarchy
109    Viewer</a>: Allows you to visualize your application's view hierarchy to find inefficiencies
110    (<strong>Window &gt; Open Perspective &gt; Hierarchy Viewer</strong>).</li>
111
112    <li><a href="{@docRoot}tools/debugging/debugging-ui.html#pixelperfect">Pixel
113    Perfect</a>: Allows you to closely examine your UI to help with designing and building.
114    (<strong>Window &gt; Open Perspective &gt; Pixel Perfect</strong>).</li>
115
116    <li><a href="{@docRoot}tools/debugging/ddms.html">DDMS</a>: Provides
117    debugging features including: screen capturing, thread and heap information, and logcat
118    (<strong>Window &gt; Open Perspective &gt; DDMS</strong>).</li>
119
120    <li><a href="{@docRoot}tools/help/adb.html">adb</a>: Provides access to
121      a device from your development system. Some features of
122    <code>adb</code> are integrated into ADT such as project installation (Eclipse run menu),
123    file transfer, device enumeration, and logcat (DDMS). You must access the more advanced
124    features of <code>adb</code>, such as shell commands, from the command line.</li>
125
126    <li><a href="{@docRoot}tools/help/proguard.html">ProGuard</a>: Allows code obfuscation,
127    shrinking, and optimization. ADT integrates ProGuard as part of the build, if you <a href=
128    "{@docRoot}tools/help/proguard.html#enabling">enable it</a>.</li>
129  </ul>
130
131<h2 id="editors">Code Editors</h2>
132
133  <p>In addition to Eclipse's standard editor features, ADT provides custom XML editors to help
134  you create and edit Android manifests, resources, menus, and layouts in a form-based or graphical
135  mode. Double-clicking on an XML file in Eclipse's package explorer opens the
136  appropriate XML editor.
137
138    <div class="sidebox-wrapper">
139    <div class="sidebox">
140      <h2>Google I/O Session Video</h2>
141      <p>View the segment on the <a href=
142      "http://www.youtube.com/watch?v=Oq05KqjXTvs#t=30m50s">XML editors</a> for more
143      information.</p>
144    </div>
145  </div>
146
147  <p class="note"><strong>Note:</strong> You can edit Android-specific XML files (such as a layout
148or manifest) in both a graphical mode and also an XML markup mode. You can switch between
149these modes with the pair of tabs at the bottom of each custom XML editor.</p>
150
151  <p>In addition, some special file types that don't have custom editors, such as drawables, animations,
152  and color files offer editing enhancements such as XML tag completion.</p>
153
154<p>ADT provides the following custom, form-based XML editors:</p>
155
156  <dl>
157
158    <dt><strong>Graphical Layout Editor</strong></dt>
159
160    <dd>Edit and design your XML layout files with a drag and drop interface. The layout editor
161    renders your interface as well, offering you a preview as you design your layouts. This editor
162    is invoked when you open an XML file with a view declared (usually declared in
163    <code>res/layout</code>. For more information, see <a href="#graphical-editor">Graphical Layout
164    Editor</a>.</dd>
165
166    <dt><strong>Android Manifest Editor</strong></dt>
167
168    <dd>Edit Android manifests with a simple graphical interface. This editor is invoked
169    when you open an <code>AndroidManifest.xml</code> file.</dd>
170
171    <dt><strong>Menu Editor</strong></dt>
172
173    <dd>Edit menu groups and items with a simple graphical interface. This editor is
174    invoked when you open an XML file with a <code>&lt;menu&gt;</code> declared (usually located in
175    the <code>res/menu</code> folder).</dd>
176
177    <dt><strong>Resources Editor</strong></dt>
178
179    <dd>Edit resources with a simple graphical interface. This editor is invoked when
180    you open an XML file with a <code>&lt;resources&gt;</code> tag declared.</dd>
181
182    <dt><strong>XML Resources Editor</strong></dt>
183
184    <dd>Edit XML resources with a simple graphical interface. This editor is invoked
185    when you open an XML file.</dd>
186  </dl>
187
188
189  <h3 id="resource-linking">Resource linking enhancements</h3>
190  <p>In addition to the normal code editing features of Eclipse, ADT provides enhancements to the Android
191  development experience that allow you to quickly jump to declarations of various types of resources such
192  as strings or layout files. You can access these enhancements by holding down the control key and
193  clicking on the following items:
194
195      <ul>
196
197        <li>A resource identifier, such as <code>R.id.button1</code>, jumps
198        to the XML definition of the view.</li>
199
200        <li>A declaration in the <code>R.java</code> file, such as <code>public
201        static final int Button01=0x7f050000"</code>, jumps to the corresponding XML definition.</li>
202
203        <li>An activity or service definition in your manifest, such as
204        <code>&lt;activity android:name=".TestActivity"&gt;</code>, jumps to the corresponding Java class. You can
205        jump from an activity definition (or service definition) into the corresponding Java class.</li>
206
207        <li>You can jump to any value definition (e.g. <code>@string:foo</code>), regardless of
208which XML file
209        "foo" is defined in.</li>
210
211        <li>Any file-based declaration, such as <code>@layout/bar</code>, opens the file.</li>
212
213        <li>Non-XML resources, such as <code>@drawable/icon</code>, launches
214        Eclipse's default application for the given file type, which in this case is an
215        image.</li>
216
217        <li><code>@android</code> namespace resources opens the resources found in
218        the SDK install area.</li>
219
220        <li>Custom views in XML layouts, such as <code>&lt;foo.bar.MyView&gt;&lt;/foo.bar.MyView&gt;</code>,
221        or <code>&lt;view class="foo.bar.MyView"&gt;</code>) jump to the corresponding custom view classes.</li>
222
223        <li>An XML attribute such as <code>@android:string/ok</code> or <code>android.R.string.id</code> in Java code
224        opens the file that declares the strings. The XML tab opens when doing this, not
225        the form-based editor.</li>
226
227      </ul>
228
229  <h2 id="graphical-editor">Graphical Layout Editor</h2>
230
231  <p>ADT provides many features to allow you to design and build your application's user interface.
232  Many of these features are in the graphical layout editor, which you can access by opening one of
233  your application's XML layout files in Eclipse.
234  </p>
235
236  <p>The graphical layout editor is the main screen that you use to visually design and build your
237  UI. It is split up into the following parts:</p>
238
239  <dl>
240    <dt><strong>Canvas</strong></dt>
241
242    <dd>In the middle of the editor is the canvas. It provides the rendered view of your
243    layout and supports dragging and dropping of UI widgets
244    directly from the palette. You can select the platform version used to render the items in
245    the canvas. Each platform version has its own look and feel, which might be the similar to or
246    radically different from another platform version. The canvas renders the appropriate look
247    and feel for the currently selected platform version.
248    This platform version does not need to be the same as the version that your
249    application targets.
250
251    <p>The canvas also provides
252    context-sensitive actions in the layout actions bar, such as adjusting layout margins and
253orientation.
254    The layout actions bar displays available actions depending on the selected UI element in the
255    canvas.</p>
256    </dd>
257
258    <dt><strong>Outline</strong></dt>
259
260    <dd>On the right side of the editor is the outline view. It displays a hierarchical
261    view of your layout where you can do things such as reorder of views. The outline
262    view exposes similar functionality as the canvas but displays your layout in an ordered
263    list instead of a rendered preview.</dd>
264
265    <dt><strong>Palette</strong></dt>
266
267    <dd>On the left side of the editor is the palette. It provides a set of widgets that
268    you can drag onto the canvas. The palette shows rendered previews of the
269    widgets for easy lookup of desired UI widgets.</dd>
270
271    <dt><strong>Configuration Chooser</strong></dt>
272
273    <dd>At the top of the editor is the configuration chooser.
274    It provides options to change a layout's rendering mode or screen type.</dd>
275  </dl>
276
277  <img src="{@docRoot}images/layout_editor.png" alt="graphical layout editor screenshot"
278  height="500" id="layout-editor" name="layout-editor">
279
280  <p class="img-caption"><strong>Figure 1.</strong> Graphical layout editor</p>
281
282  <h3 id="canvas">Canvas and outline view</h3>
283
284  <div class="sidebox-wrapper">
285    <div class="sidebox">
286      <h2>Google I/O Session Video</h2>
287
288      <p>View the segment on the <a href=
289      "http://www.youtube.com/watch?v=Oq05KqjXTvs#t=7m16s">canvas and outline view</a> and the
290      <a href="http://www.youtube.com/watch?v=Oq05KqjXTvs#t=11m43s">layout actions bar</a>
291      for more information.
292      </p>
293    </div>
294  </div>
295
296  <p>The canvas is the area where you can drag and drop UI widgets from the palette to design your
297  layout. The canvas offers a rendered preview of your layout depending on factors such as the
298  selected platform version, screen orientation, and currently selected theme that you specify in
299  the <a href="#configuration-chooser">configuration chooser</a>. You can also drag and drop
300  items into the outline view, which displays your layout in a hierarchical list. The outline view
301  exposes much of the same functionality as the canvas but offers another method of organization
302  that is beneficial for ordering and quickly selecting items. When you right-click a specific item
303  in the canvas or outline view, you can access a context-sensitive menu that lets you modify the
304  following attributes of the layout or view:</p>
305
306  <dl>
307    <dt><strong>View and layout properties</strong></dt>
308
309    <dd>
310      When you right-click a view or layout in the canvas or outline view, it brings up a
311      context-sensitive menu that lets you set things such as:
312
313      <ul>
314        <li>ID of the view or layout</li>
315
316        <li>Text of the view</li>
317
318        <li>Layout width</li>
319
320        <li>Layout height</li>
321
322        <li>Properties such as alpha or clickable</li>
323      </ul>
324    </dd>
325
326    <dt><strong>Animation preview and creation</strong></dt>
327
328    <dd>
329      If your layout or view is animated, you can preview the animation directly in the canvas
330      (when you select Android 3.0 or later as the platform version in the configuration chooser).
331      Right-click an item in the canvas and select <strong>Play Animation</strong>. If
332      animation is not associated with item, an option is available in the menu to create one.
333
334      <p>View the segment on the <a href=
335      "http://www.youtube.com/watch?v=Oq05KqjXTvs#t=28m30s">animation features</a> for more
336      information.</p>
337    </dd>
338
339    <dt><strong>Extract as Include</strong></dt>
340
341    <dd>You can extract parts of a current layout into its own layout file,
342    which you can then include in any layout with a single line of XML. See <a href=
343    "#extract-as-include">Layout Refactoring Support</a> for more information.</dd>
344  </dl>
345
346  <h4>Other canvas features</h4>
347
348  <p>The canvas has additional features not available in the outline view:</p>
349
350  <ul>
351
352    <li>Edit views with the layout actions bar: The context-sensitive layout actions bar allows you to
353    edit how a view is laid out in your UI. The available actions depend on the currently
354    selected view and its parent layout. Some common actions include
355    toggling the fill mode of the view and specifying margins. For instance, if you select a
356    {@link android.widget.Button}
357    in a {@link android.widget.LinearLayout}, you see actions related to the {@link
358android.widget.LinearLayout}, such as a toggle to switch
359    between horizontal and vertical layout, and a toggle to control whether its children are
360    aligned along their text baseline. You will also see toolbar actions to control the individual
361    layout attributes of the child, such as whether the child should stretch out to match its
362    parent's width and height, a dropdown action to set the child's layout gravity, a button to open
363    a margin editor, and a layout weight editor.</li>
364
365    <li>Edit a nested layout in its current context: If you are editing a layout
366    that includes another layout, you can edit the included layout in the layout that included
367    it.</li>
368
369    <li>Preview drag and drop location: When you drag and drop a UI widget onto the canvas, ruler
370    markers appear showing you the approximate location of the UI widget depending on the
371    type of layout, such as {@link android.widget.RelativeLayout} or {@link
372    android.widget.LinearLayout}.</li>
373
374    <li>Preview animations: You can preview view and layout animations when you select Android 2.1
375    or later for the platform version in the configuration bar.</li>
376
377    <li>Render layouts in real-time: Layouts are rendered as accurately as possible according to
378    the platform version, including the appropriate system and action bars.</li>
379
380    <li>Support for fragments: Fragments can be rendered in the same screen as the layout that
381    includes the fragments.</li>
382
383  </ul>
384
385  <img src="{@docRoot}images/canvas.png" alt="screenshot of the canvas" height="553">
386
387  <p class="img-caption"><strong>Figure 2.</strong> Canvas portion of the layout editor showing
388  a rendered preview of an application</p>
389
390  <img src=
391  "{@docRoot}images/layout_outline.png" alt="screenshot of the outline view" height="185">
392
393  <p class="img-caption"><strong>Figure 3.</strong> Outline view showing current layout's structure</p>
394
395  <h3 id="palette">Palette</h3>
396
397  <div class="sidebox-wrapper">
398    <div class="sidebox">
399      <h2>Google I/O Session Video</h2>
400
401      <p>View the segment on the <a href=
402      "http://www.youtube.com/watch?v=Oq05KqjXTvs#t=7m53s">palette</a> for more information.</p>
403    </div>
404  </div>
405
406  <p>The palette contains the UI widgets that you can drag and drop onto the canvas and add to your
407  layout. The pallete categorizes the widgets and shows rendered previews
408  for easier lookup. The main features of the palette include:</p>
409
410  <ul>
411    <li>Different modes of rendered previews include: icons only, icons and text, tiny previews,
412    small previews, and previews (rendered in real size). Previews are only available for layouts
413    rendered with the latest revisions of Android 2.1 (API Level 7) or later.</li>
414
415    <li>Custom views in your project or library projects are added under custom views
416    category.</li>
417
418    <li>Arrange UI widgets alphabetically or by category.</li>
419  </ul>
420  <img src="{@docRoot}images/palette.png" alt="palette screenshot" height="566">
421
422  <p class="img-caption"><strong>Figure 4.</strong> Palette showing available UI widgets</p>
423
424  <h3 id="config-chooser">Configuration chooser</h3>
425
426  <div class="sidebox-wrapper">
427    <div class="sidebox">
428      <h2>Google I/O Session Video</h2>
429
430      <p>View the segment on the <a href=
431      "http://www.youtube.com/watch?v=Oq05KqjXTvs#t=12m51s">configuration chooser</a> for more
432      information.</p>
433    </div>
434  </div>
435
436
437  <p>The configuration chooser allows you to create and configure different configurations of
438  a layout for different situations, such as one for landscape and one for portrait mode. You can
439  set the following options for each configuration of a layout:
440  </p>
441      <ul>
442        <li>Screen type combo box: Predefined screen settings for common device configurations. You
443        can also create your own by selecting <strong>Custom...</strong>.</li>
444
445        <li>Screen orientation combo box: Portrait or Landscape screen orientation.</li>
446
447        <li>Theme combo box: Predefined themes or a custom theme that you have created.</li>
448
449        <li>Platform combo box: Platform version used to render the canvas and palette as well as
450        displaying appropriate themes.</li>
451
452        <li>Custom layout combo boxes: The locale, dock, and time of day combo boxes let you select
453        different versions of the same layout depending on the device's current state. You can
454        create a new version of a layout with the <strong>Create</strong> button.</li>
455      </ul>
456
457      <img src="{@docRoot}images/layout_bar.png" alt=
458  "configuration chooser screenshot" height="50" id="configuration-chooser" name="configuration chooser">
459
460  <p class="img-caption"><strong>Figure 5.</strong> Configuration chooser</p>
461
462  <h2 id="refactoring">Layout Refactoring Support</h2>
463
464  <div class="sidebox-wrapper">
465    <div class="sidebox">
466      <h2>Google I/O Session Video</h2>
467
468      <p>View the segment on <a href=
469      "http://www.youtube.com/watch?v=Oq05KqjXTvs#t=18m00s">refactoring features</a> for a rundown
470of the more important refactoring features.</p>
471
472    </div>
473  </div>
474
475  <p>In both the graphical and XML layout editor, there are many features that help you quickly
476  refactor your layouts. The following list describes the major refactoring support:</p>
477
478  <dl>
479
480    <dt><strong>Change layout</strong></dt>
481    <dd>This lets you change the layout on the fly and re-renders the canvas for you.
482    You can apply this refactoring to any layout and the layout is converted to the new type if
483    possible. In many cases, the opening and closing tags of the layout's XML element are changed
484    along with things such as ID attributes and their references. However, for some supported
485    types, ADT attempts to preserve the layout, such as changing a {@link
486    android.widget.LinearLayout} to a {@link android.widget.RelativeLayout}.</dd>
487
488    <dt><strong>Change widget</strong></dt>
489    <dd>This lets you select one or more widgets and converts them to a new widget type. In
490    addition to changing the element name, it also removes any
491    attributes that are not supported by the new widget type and adds in any mandatory attributes
492    required by the new widget type. If the current ID of a widget includes the
493    current widget type in its ID (such as a <code>&lt;Button&gt;</code> widget named
494    <code>"button1"</code>), then the ID is changed to match the new widget type and all
495    references are updated.</dd>
496
497    <dt id="extract-as-include"><strong>Extract as include</strong></dt>
498    <dd>This lets you extract views inside of an existing layout into their own separate layout
499    file. An <code>include</code> tag that points to the newly created layout file is inserted
500    into the existing layout file. Right-click the view or layout and select <strong>Extract as
501    Include...</strong>.</dd>
502
503    <dt><strong>Extract string</strong></dt>
504    <dd>Extract strings from either XML or Java files into their own separate resource file.</dd>
505
506    <dt><strong>Extract style</strong></dt>
507    <dd>Extract style-related attributes from a layout and define them in a new
508    <code>styles.xml</code> file. You can select multiple views and this refactoring extracts all
509    of the same styles into one style and assigns that style to all the views that use it.</dd>
510
511    <dt><strong>Wrap-in container</strong></dt>
512    <dd>This lets you select one or more sibling elements and wrap them in a new container. This
513    can be applied to the root element as well, in which case the namespace declaration attributes
514    will be transferred to the new root. This refactoring also transfers <code>layout_</code>
515    attribute references to the new root, For example, suppose you have a {@link android.widget.RelativeLayout}.
516    If other widgets have layout constraints pointing to your widget, wrapping the widget causes
517    these constraints to point to the parent instead.</dd>
518
519    <dt><strong>Quick Assistant</strong></dt>
520    <dd>Provides refactoring suggestions depending on the current context. Press
521    <strong>Ctrl-1</strong> (or <strong>Cmd-1</strong> on
522    Mac) in an editor, and Eclipse provides a list of possible refactorings depending on the
523    context. The Quick Assistant provides fast access to all of the above refactorings, where applicable.
524    For example, if you are editing an XML value and decide you want to extract it out
525    as a string, place the text cursor in the string and press Ctrl-1 to see the refactoring context
526    menu.</dd>
527  </dl>
528