diff options
Diffstat (limited to 'docs/html/guide/topics/ui')
| -rw-r--r-- | docs/html/guide/topics/ui/accessibility/apps.jd | 8 | ||||
| -rw-r--r-- | docs/html/guide/topics/ui/accessibility/checklist.jd | 2 | ||||
| -rw-r--r-- | docs/html/guide/topics/ui/accessibility/services.jd | 4 | ||||
| -rw-r--r-- | docs/html/guide/topics/ui/actionbar.jd | 67 | ||||
| -rw-r--r-- | docs/html/guide/topics/ui/controls/checkbox.jd | 2 | ||||
| -rw-r--r-- | docs/html/guide/topics/ui/controls/pickers.jd | 8 | ||||
| -rw-r--r-- | docs/html/guide/topics/ui/declaring-layout.jd | 17 | ||||
| -rw-r--r-- | docs/html/guide/topics/ui/dialogs.jd | 4 | ||||
| -rw-r--r-- | docs/html/guide/topics/ui/how-android-draws.jd | 115 | ||||
| -rw-r--r-- | docs/html/guide/topics/ui/layout/listview.jd | 2 | ||||
| -rw-r--r-- | docs/html/guide/topics/ui/layout/tabs.jd | 219 | ||||
| -rw-r--r-- | docs/html/guide/topics/ui/notifiers/notifications.jd | 4 |
12 files changed, 123 insertions, 329 deletions
diff --git a/docs/html/guide/topics/ui/accessibility/apps.jd b/docs/html/guide/topics/ui/accessibility/apps.jd index 13b4538..da24d03 100644 --- a/docs/html/guide/topics/ui/accessibility/apps.jd +++ b/docs/html/guide/topics/ui/accessibility/apps.jd @@ -351,7 +351,7 @@ following approaches:</p> <li>If your application targets Android 4.0 (API level 14) and higher, override and implement the accessibility methods listed above directly in your custom view class.</li> <li>If your custom view is intended to be compatible with Android 1.6 (API Level 4) and above, add -the Android <a href="{@docRoot}tools/extras/support-library.html">Support Library</a>, revision 5 or +the Android <a href="{@docRoot}tools/support-library/index.html">Support Library</a>, revision 5 or higher, to your project. Then, within your custom view class, call the {@link android.support.v4.view.ViewCompat#setAccessibilityDelegate ViewCompat.setAccessibilityDelegate()} method to implement the accessibility methods @@ -490,7 +490,7 @@ appropriate feedback to users.</p> <p>The example code below shows how override these three methods by using {@link android.support.v4.view.ViewCompat#setAccessibilityDelegate ViewCompat.setAccessibilityDelegate()}. Note that this sample code requires that the Android -<a href="{@docRoot}tools/extras/support-library.html">Support Library</a> for API Level 4 (revision +<a href="{@docRoot}tools/support-library/index.html">Support Library</a> for API Level 4 (revision 5 or higher) is added to your project.</p> <pre> @@ -534,7 +534,7 @@ ViewCompat.setAccessibilityDelegate(new AccessibilityDelegateCompat() { <p>In applications targeting Android 4.0 (API Level 14) and higher, you can implement these methods directly in your custom view class. For another example of this approach, see the Android -<a href="{@docRoot}tools/extras/support-library.html">Support Library</a> (revision 5 or higher) +<a href="{@docRoot}tools/support-library/index.html">Support Library</a> (revision 5 or higher) sample {@code AccessibilityDelegateSupportActivity} in ({@code <sdk>/extras/android/support/v4/samples/Support4Demos/}).</p> @@ -594,7 +594,7 @@ methods.</p> example implementation of this accessibility feature, see {@code AccessibilityNodeProviderActivity} in the ApiDemos sample project. You can implement a virtual view hierarchy that is compatible with Android 1.6 and later by using the - <a href="{@docRoot}tools/extras/support-library.html">Support Library</a> with the + <a href="{@docRoot}tools/support-library/index.html">Support Library</a> with the {@link android.support.v4.view.ViewCompat#getAccessibilityNodeProvider ViewCompat.getAccessibilityNodeProvider()} method and providing an implementation with {@link android.support.v4.view.accessibility.AccessibilityNodeProviderCompat}.</p> diff --git a/docs/html/guide/topics/ui/accessibility/checklist.jd b/docs/html/guide/topics/ui/accessibility/checklist.jd index 9473d1b..960cca2 100644 --- a/docs/html/guide/topics/ui/accessibility/checklist.jd +++ b/docs/html/guide/topics/ui/accessibility/checklist.jd @@ -73,7 +73,7 @@ helps you focus on the key development issues to get the details of accessibilit your application, <a href="{@docRoot}guide/topics/ui/accessibility/apps.html#custom-views"> implement accessibility interfaces</a> for your custom views and provide content descriptions. For custom controls that are intended to be compatible with versions of Android back to 1.6, - use the <a href="{@docRoot}tools/extras/support-library.html">Support Library</a> to implement + use the <a href="{@docRoot}tools/support-library/index.html">Support Library</a> to implement the latest accessibility features.</li> <li><strong>No audio-only feedback:</strong> Audio feedback must always have a secondary feedback mechanism to support users who are deaf or hard of hearing. For example, a sound alert diff --git a/docs/html/guide/topics/ui/accessibility/services.jd b/docs/html/guide/topics/ui/accessibility/services.jd index 2a6fe7a..4bd752f 100644 --- a/docs/html/guide/topics/ui/accessibility/services.jd +++ b/docs/html/guide/topics/ui/accessibility/services.jd @@ -55,7 +55,7 @@ accessibility service.</p> <p>The ability for you to build and deploy accessibility services was introduced with Android 1.6 (API Level 4) and received significant improvements with Android 4.0 (API Level 14). The Android - <a href="{@docRoot}tools/extras/support-library.html">Support Library</a> was also updated with + <a href="{@docRoot}tools/support-library/index.html">Support Library</a> was also updated with the release of Android 4.0 to provide support for these enhanced accessibility features back to Android 1.6. Developers aiming for widely compatible accessibility services are encouraged to use the Support Library and develop for the more advanced accessibility features introduced in @@ -448,7 +448,7 @@ android.accessibilityservice.AccessibilityService} and can be used as a base for accessibility services that are compatible with Android 1.6 (API Level 4) and higher.</li> <li><a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/accessibility/TaskBackService.html">TaskBackService</a> - This service is based on the enhanced accessibility APIs introduced in Android 4.0 (API Level -14). However, you can use the Android <a href="{@docRoot}tools/extras/support-library.html">Support +14). However, you can use the Android <a href="{@docRoot}tools/support-library/index.html">Support Libary</a> to substitute classes introduced in later API levels (e.g., {@link android.view.accessibility.AccessibilityRecord}, {@link android.view.accessibility.AccessibilityNodeInfo} diff --git a/docs/html/guide/topics/ui/actionbar.jd b/docs/html/guide/topics/ui/actionbar.jd index 453d9d7..3173ff1 100644 --- a/docs/html/guide/topics/ui/actionbar.jd +++ b/docs/html/guide/topics/ui/actionbar.jd @@ -1,7 +1,6 @@ page.title=Action Bar -page.tags="actionbar","menu" -parent.title=User Interface -parent.link=index.html +page.tags="actionbar","menu","tabs" + @jd:body @@ -89,7 +88,7 @@ design guide.</p> <p>The {@link android.app.ActionBar} APIs were first added in Android 3.0 (API level 11) but they are also available in the <a href="{@docRoot}tools/support-library/index.html">Support Library</a> -for compatibility with Android 2.2 (API level 7) and above.</p> +for compatibility with Android 2.1 (API level 7) and above.</p> <p><b>This guide focuses on how to use the support library's action bar</b>, but if your app supports <em>only</em> Android 3.0 or higher, you @@ -133,7 +132,7 @@ Library Setup</a>.</p> </li> </ol> -<p>Now your activity includes the action bar when running on Android 2.2 (API level 7) or higher. +<p>Now your activity includes the action bar when running on Android 2.1 (API level 7) or higher. </p> <div class="note"> @@ -254,11 +253,11 @@ showAsAction="ifRoom"} in the {@code <item>} tag. For example:</p> <pre> <menu xmlns:android="http://schemas.android.com/apk/res/android" - <strong>xmlns:example.app="http://schemas.android.com/apk/res-auto"</strong> > + <strong>xmlns:yourapp="http://schemas.android.com/apk/res-auto"</strong> > <item android:id="@+id/action_search" android:icon="@drawable/ic_action_search" android:title="@string/action_search" - <strong>example.app:showAsAction="ifRoom"</strong> /> + <strong>yourapp:showAsAction="ifRoom"</strong> /> ... </menu> </pre> @@ -282,7 +281,7 @@ want to display the text title, add {@code "withText"} to the {@code showAsActio attribute. For example:</p> <pre> -<item example.app:showAsAction="ifRoom|withText" ... /> +<item yourapp:showAsAction="ifRoom|withText" ... /> </pre> <p class="note"><strong>Note:</strong> The {@code "withText"} value is a <em>hint</em> to the @@ -373,33 +372,29 @@ items on a narrow screen, while leaving room for navigation and title elements a <p>To enable split action bar when using the support library, you must do two things:</p> <ol> - <li>Add {@code uiOptions="splitActionBarWhenNarrow"} to your -<a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a> or + <li>Add {@code uiOptions="splitActionBarWhenNarrow"} to each +<a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a> +element or to the <a href="{@docRoot}guide/topics/manifest/application-element.html">{@code <application>}</a> -manifest element. This attribute is understood only by API level 14 and higher (it is ignored -by older versions). - <li>For older versions, create a custom theme that extends one of the {@link - android.support.v7.appcompat.R.style#Theme_AppCompat Theme.AppCompat} themes, and include - the {@link android.support.v7.appcompat.R.attr#windowSplitActionBar windowSplitActionBar} style - set {@code true}. For example: - <p class="code-caption">res/values/styles.xml</p> - <pre> -<style name="MyAppTheme" parent="Theme.AppCompat.Light"> - <item name="windowSplitActionBar">true<item> -</style> -</pre> +element. This attribute is understood only by API level 14 and higher (it is ignored +by older versions).</li> + <li>To support older versions, add a <a + href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code <meta-data>}</a> + element as a child of each + <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a> + element that declares the same value for {@code "android.support.UI_OPTIONS"}.</li> +</ol> - <p>Then set this as your activity theme:</p> +<p>For example:</p> - <p class="code-caption">AndroidManifest.xml</p> - <pre> +<pre> <manifest ...> - <activity android:theme="@style/MyAppTheme" ...> - ... -</manifest ...> + <activity uiOptions="splitActionBarWhenNarrow" ... > + <meta-data android:name="android.support.UI_OPTIONS" + android:value="splitActionBarWhenNarrow" /> + </activity> +</manifest> </pre> - </li> -</ol> <p>Using split action bar also allows <a href="#Tabs">navigation tabs</a> to collapse into the @@ -572,12 +567,12 @@ the {@link android.support.v7.widget.SearchView} widget:</p> <pre> <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:example.app="http://schemas.android.com/apk/res-auto" > + xmlns:yourapp="http://schemas.android.com/apk/res-auto" > <item android:id="@+id/action_search" android:title="@string/action_search" android:icon="@drawable/ic_action_search" - example.app:showAsAction="ifRoom|collapseActionView" - <b>example.app:actionViewClass="android.support.v7.widget.SearchView"</b> /> + yourapp:showAsAction="ifRoom|collapseActionView" + <b>yourapp:actionViewClass="android.support.v7.widget.SearchView"</b> /> </menu> </pre> @@ -720,11 +715,11 @@ the {@link android.support.v7.widget.ShareActionProvider} class. For example:</p <pre> <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:example.app="http://schemas.android.com/apk/res-auto" > + xmlns:yourapp="http://schemas.android.com/apk/res-auto" > <item android:id="@+id/action_share" android:title="@string/share" - example.app:showAsAction="ifRoom" - <strong>example.app:actionProviderClass="android.support.v7.widget.ShareActionProvider"</strong> + yourapp:showAsAction="ifRoom" + <strong>yourapp:actionProviderClass="android.support.v7.widget.ShareActionProvider"</strong> /> ... </menu> diff --git a/docs/html/guide/topics/ui/controls/checkbox.jd b/docs/html/guide/topics/ui/controls/checkbox.jd index 99140b5..2a64e38 100644 --- a/docs/html/guide/topics/ui/controls/checkbox.jd +++ b/docs/html/guide/topics/ui/controls/checkbox.jd @@ -94,7 +94,7 @@ must have a signature exactly as shown above. Specifically, the method must:</p> android.view.View} that was clicked)</li> </ul> -<p class="note"><strong>Tip:</strong> If you need to change the radio button state +<p class="note"><strong>Tip:</strong> If you need to change the checkbox state yourself (such as when loading a saved {@link android.preference.CheckBoxPreference}), use the {@link android.widget.CompoundButton#setChecked(boolean)} or {@link android.widget.CompoundButton#toggle()} method.</p>
\ No newline at end of file diff --git a/docs/html/guide/topics/ui/controls/pickers.jd b/docs/html/guide/topics/ui/controls/pickers.jd index a0e7afb..4c55840 100644 --- a/docs/html/guide/topics/ui/controls/pickers.jd +++ b/docs/html/guide/topics/ui/controls/pickers.jd @@ -47,11 +47,11 @@ such as in a basic dialog on handsets or as an embedded part of the layout on la <p>Although {@link android.app.DialogFragment} was first added to the platform in Android 3.0 (API level 11), if your app supports versions of Android older than 3.0—even as low as Android 1.6—you can use the {@link android.support.v4.app.DialogFragment} class that's available in -the <a href="{@docRoot}tools/extras/support-library.html">support library</a> for backward +the <a href="{@docRoot}tools/support-library/index.html">support library</a> for backward compatibility.</p> <p class="note"><strong>Note:</strong> The code samples below show how to create dialogs for a time -picker and date picker using the <a href="{@docRoot}tools/extras/support-library.html">support +picker and date picker using the <a href="{@docRoot}tools/support-library/index.html">support library</a> APIs for {@link android.support.v4.app.DialogFragment}. If your app's <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code minSdkVersion}</a> is 11 or higher, you can instead use the platform version of {@link android.app.DialogFragment}.</p> @@ -67,7 +67,7 @@ fragment's {@link android.support.v4.app.DialogFragment#onCreateDialog onCreateD <p class="note"><strong>Note:</strong> If your app supports versions of Android older than 3.0, be sure you've set up your Android project with the support library as described in <a -href="{@docRoot}tools/extras/support-library.html#SettingUp">Setting Up a Project to Use a +href="{@docRoot}tools/support-library/setup.html">Setting Up a Project to Use a Library</a>.</p> <h3 id="TimePickerFragment">Extending DialogFragment for a time picker</h3> @@ -172,7 +172,7 @@ fragment's {@link android.support.v4.app.DialogFragment#onCreateDialog onCreateD <p class="note"><strong>Note:</strong> If your app supports versions of Android older than 3.0, be sure you've set up your Android project with the support library as described in <a -href="{@docRoot}tools/extras/support-library.html#SettingUp">Setting Up a Project to Use a +href="{@docRoot}tools/support-library/setup.html">Setting Up a Project to Use a Library</a>.</p> <h3 id="DatePickerFragment">Extending DialogFragment for a date picker</h3> diff --git a/docs/html/guide/topics/ui/declaring-layout.jd b/docs/html/guide/topics/ui/declaring-layout.jd index 6398646..6586c2f 100644 --- a/docs/html/guide/topics/ui/declaring-layout.jd +++ b/docs/html/guide/topics/ui/declaring-layout.jd @@ -359,23 +359,6 @@ partially or totally obscuring them (unless the newer object is transparent). <p>Enables you to specify the location of child objects relative to each other (child A to the left of child B) or to the parent (aligned to the top of the parent).</p> </div> - -<!-- -<div class="layout"> - <h4><a href="layout/tabs.html">Tabs</a></h4> - <a href="layout/tabs.html"><img src="{@docRoot}images/ui/tabs-small.png" alt="" /></a> - <p>Provides a tab selection list that monitors clicks and enables the application to change -the screen whenever a tab is clicked.</p> -</div> - -<div class="layout first"> - <h4><a href="layout/grid.html">Table Layout</a></h4> - <a href="layout/table.html"><img src="{@docRoot}images/ui/gridlayout-small.png" alt="" /></a> - <p>A tabular layout with an arbitrary number of rows and columns, each cell holding the -widget of your choice. The rows resize to fit the largest column. The cell borders are not -visible.</p> -</div> ---> <div class="layout"> <h4><a href="{@docRoot}guide/webapps/webview.html">Web View</a></h4> diff --git a/docs/html/guide/topics/ui/dialogs.jd b/docs/html/guide/topics/ui/dialogs.jd index 7f48eac..d934c4b 100644 --- a/docs/html/guide/topics/ui/dialogs.jd +++ b/docs/html/guide/topics/ui/dialogs.jd @@ -97,7 +97,7 @@ object. If you'd like to create a date or time picker, you should instead read t Because the {@link android.app.DialogFragment} class was originally added with Android 3.0 (API level 11), this document describes how to use the {@link android.support.v4.app.DialogFragment} class that's provided with the <a -href="{@docRoot}tools/extras/support-library.html">Support Library</a>. By adding this library +href="{@docRoot}tools/support-library/index.html">Support Library</a>. By adding this library to your app, you can use {@link android.support.v4.app.DialogFragment} and a variety of other APIs on devices running Android 1.6 or higher. If the minimum version your app supports is API level 11 or higher, then you can use the framework version of {@link @@ -593,7 +593,7 @@ public class NoticeDialogFragment extends DialogFragment { .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // Send the negative button event back to the host activity - mListener.onDialogPositiveClick(NoticeDialogFragment.this); + mListener.onDialogNegativeClick(NoticeDialogFragment.this); } }); return builder.create(); diff --git a/docs/html/guide/topics/ui/how-android-draws.jd b/docs/html/guide/topics/ui/how-android-draws.jd index 6a8cd86..168f77b 100644 --- a/docs/html/guide/topics/ui/how-android-draws.jd +++ b/docs/html/guide/topics/ui/how-android-draws.jd @@ -4,15 +4,19 @@ parent.link=index.html @jd:body -<p>When an Activity receives focus, it will be requested to draw its layout. -The Android framework will handle the procedure for drawing, but the Activity must provide +<p>When an {@link android.app.Activity} receives focus, it will be requested to +draw its layout. +The Android framework will handle the procedure for drawing, but the +{@link android.app.Activity} must provide the root node of its layout hierarchy.</p> <p>Drawing begins with the root node of the layout. It is requested to measure and -draw the layout tree. Drawing is handled by walking the tree and rendering each View that - intersects the invalid region. In turn, each View group is responsible for requesting -each of its children to be drawn (with the <code>{@link android.view.View#draw(Canvas) draw()}</code> method) -and each View is responsible for drawing itself. +draw the layout tree. Drawing is handled by walking the tree and rendering each +{@link android.view.View} that intersects the invalid region. In turn, each +{@link android.view.ViewGroup} is responsible for requesting +each of its children to be drawn +(with the {@link android.view.View#draw(Canvas) draw()} method) +and each {@link android.view.View} is responsible for drawing itself. Because the tree is traversed in-order, this means that parents will be drawn before (i.e., behind) their children, with siblings drawn in the order they appear in the tree. @@ -20,76 +24,107 @@ and each View is responsible for drawing itself. <div class="sidebox-wrapper"> <div class="sidebox"> - <p>The framework will not draw Views that are not in the invalid region, and also - will take care of drawing the Views background for you.</p> - <p>You can force a View to draw, by calling <code>{@link android.view.View#invalidate()}</code>. + <p>The framework will not draw {@link android.view.View} objects that are not +in the invalid region, and also + will take care of drawing the {@link android.view.View} background for you.</p> + <p>You can force a {@link android.view.View} to draw, by calling +{@link android.view.View#invalidate()}. </p> </div> </div> <p> - Drawing the layout is a two pass process: a measure pass and a layout pass. The measuring - pass is implemented in <code>{@link android.view.View#measure(int, int)}</code> and is a top-down traversal - of the View tree. Each View pushes dimension specifications down the tree - during the recursion. At the end of the measure pass, every View has stored + Drawing the layout is a two pass process: a measure pass and a layout pass. +The measuring pass is implemented in {@link android.view.View#measure(int, int)} +and is a top-down traversal of the {@link android.view.View} tree. Each {@link android.view.View} +pushes dimension specifications down the tree + during the recursion. At the end of the measure pass, every +{@link android.view.View} has stored its measurements. The second pass happens in - <code>{@link android.view.View#layout(int,int,int,int)}</code> and is also top-down. During + {@link android.view.View#layout(int,int,int,int)} and is also top-down. During this pass each parent is responsible for positioning all of its children using the sizes computed in the measure pass. </p> <p> - When a View's <code>measure()</code> method returns, its <code>{@link android.view.View#getMeasuredWidth()}</code> and - <code>{@link android.view.View#getMeasuredHeight()}</code> values must be set, along with those for all of - that View's descendants. A View's measured width and measured height values - must respect the constraints imposed by the View's parents. This guarantees + When a {@link android.view.View} object's +{@link android.view.View#measure(int, int) measure()} method +returns, its {@link android.view.View#getMeasuredWidth()} and + {@link android.view.View#getMeasuredHeight()} values must be set, along + with those for all of that {@link android.view.View} object's descendants. +A {@link android.view.View} object's measured width and +measured height values must respect the constraints imposed by the +{@link android.view.View} object's parents. This guarantees that at the end of the measure pass, all parents accept all of their - children's measurements. A parent View may call <code>measure()</code> more than once on + children's measurements. A parent {@link android.view.View} may call +{@link android.view.View#measure(int, int) measure()} more than once on its children. For example, the parent may measure each child once with unspecified dimensions to find out how big they want to be, then call - <code>measure()</code> on them again with actual numbers if the sum of all the children's - unconstrained sizes is too big or too small (i.e., if the children don't agree among themselves - as to how much space they each get, the parent will intervene and set the rules on the second pass). + {@link android.view.View#measure(int, int) measure()} on them again with +actual numbers if the sum of all the children's + unconstrained sizes is too big or too small (that is, if the children +don't agree among themselves + as to how much space they each get, the parent will intervene and set +the rules on the second pass). </p> <div class="sidebox-wrapper"> <div class="sidebox"><p> - To initiate a layout, call <code>{@link android.view.View#requestLayout}</code>. This method is typically - called by a View on itself when it believes that is can no longer fit within + To initiate a layout, call {@link android.view.View#requestLayout}. +This method is typically + called by a {@link android.view.View} on itself +when it believes that is can no longer fit within its current bounds.</p> </div> </div> <p> The measure pass uses two classes to communicate dimensions. The - {@link android.view.ViewGroup.LayoutParams} class is used by Views to tell their parents how they - want to be measured and positioned. The base LayoutParams class just - describes how big the View wants to be for both width and height. For each + {@link android.view.ViewGroup.LayoutParams} class is used by +{@link android.view.View} objects to tell their parents how they + want to be measured and positioned. The base +{@link android.view.ViewGroup.LayoutParams} class just + describes how big the {@link android.view.View} wants to be for both +width and height. For each dimension, it can specify one of:</p> <ul> <li> an exact number - <li><var>FILL_PARENT</var>, which means the View wants to be as big as its parent + <li>{@link android.view.ViewGroup.LayoutParams#MATCH_PARENT MATCH_PARENT}, +which means the {@link android.view.View} wants to be as big as its parent (minus padding)</li> - <li><var>WRAP_CONTENT</var>, which means that the View wants to be just big enough to + <li>{@link android.view.ViewGroup.LayoutParams#WRAP_CONTENT WRAP_CONTENT}, +which means that the {@link android.view.View} wants to be just big enough to enclose its content (plus padding).</li> </ul> - <p>There are subclasses of LayoutParams for different subclasses of ViewGroup. - For example, RelativeLayout has its own subclass of LayoutParams, which includes - the ability to center child Views horizontally and vertically. + <p>There are subclasses of {@link android.view.ViewGroup.LayoutParams} for +different subclasses of {@link android.view.ViewGroup}. + For example, {@link android.widget.RelativeLayout} has its own subclass of +{@link android.view.ViewGroup.LayoutParams}, which includes + the ability to center child {@link android.view.View} objects +horizontally and vertically. </p> <p> - MeasureSpecs are used to push requirements down the tree from parent to - child. A MeasureSpec can be in one of three modes:</p> + {@link android.view.View.MeasureSpec MeasureSpec} objects are used to push +requirements down the tree from parent to + child. A {@link android.view.View.MeasureSpec MeasureSpec} can be in one of +three modes:</p> <ul> - <li><var>UNSPECIFIED</var>: This is used by a parent to determine the desired dimension - of a child View. For example, a LinearLayout may call <code>measure()</code> on its child - with the height set to <var>UNSPECIFIED</var> and a width of <var>EXACTLY</var> 240 to find out how - tall the child View wants to be given a width of 240 pixels.</li> - <li><var>EXACTLY</var>: This is used by the parent to impose an exact size on the + <li>{@link android.view.View.MeasureSpec#UNSPECIFIED UNSPECIFIED}: This is +used by a parent to determine the desired dimension + of a child {@link android.view.View}. For example, a +{@link android.widget.LinearLayout} may call +{@link android.view.View#measure(int, int) measure()} on its child + with the height set to {@link android.view.View.MeasureSpec#UNSPECIFIED UNSPECIFIED} +and a width of {@link android.view.View.MeasureSpec#EXACTLY EXACTLY} 240 to +find out how tall the child {@link android.view.View} wants to be given a +width of 240 pixels.</li> + <li>{@link android.view.View.MeasureSpec#EXACTLY EXACTLY}: This is used +by the parent to impose an exact size on the child. The child must use this size, and guarantee that all of its descendants will fit within this size.</li> - <li><var>AT_MOST</var>: This is used by the parent to impose a maximum size on the + <li>{@link android.view.View.MeasureSpec#AT_MOST AT MOST}: This is used by +the parent to impose a maximum size on the child. The child must guarantee that it and all of its descendants will fit within this size.</li> </ul> diff --git a/docs/html/guide/topics/ui/layout/listview.jd b/docs/html/guide/topics/ui/layout/listview.jd index 6cdd725..f8315c5 100644 --- a/docs/html/guide/topics/ui/layout/listview.jd +++ b/docs/html/guide/topics/ui/layout/listview.jd @@ -48,7 +48,7 @@ displays the results.</p> <p>Although the {@link android.support.v4.content.CursorLoader} APIs were first introduced in Android 3.0 (API level 11), they are also available in the <a -href="{@docRoot}tools/extras/support-library.html">Support Library</a> so that your app may use them +href="{@docRoot}tools/support-library/index.html">Support Library</a> so that your app may use them while supporting devices running Android 1.6 or higher.</p> <p>For more information about using a {@link diff --git a/docs/html/guide/topics/ui/layout/tabs.jd b/docs/html/guide/topics/ui/layout/tabs.jd deleted file mode 100644 index 62663de..0000000 --- a/docs/html/guide/topics/ui/layout/tabs.jd +++ /dev/null @@ -1,219 +0,0 @@ -page.title=Tabbed -parent.title=Layouts -parent.link=layout-objects.html -@jd:body -<div id="qv-wrapper"> -<div id="qv"> -<h2>In this document</h2> - <ol> - <li><a href="#example">Example</a></li> - </ol> - <h2>Key classes</h2> - <ol> -<li>{@link android.widget.TabWidget}</li> -<li>{@link android.widget.TabHost}</li> -<li>{@link android.widget.TabHost.TabSpec}</li> -<li>{@link android.widget.FrameLayout}</li> - </ol> -</div> -</div> -<p>To create a tabbed UI, you need to use a {@link android.widget.TabHost} and a {@link -android.widget.TabWidget}. The {@link android.widget.TabHost} must be the root node for the layout, -which contains both the {@link android.widget.TabWidget} for displaying the tabs and a {@link -android.widget.FrameLayout} for displaying the tab content.</p> - -<img src="{@docRoot}images/ui/tabs.png" alt="" /> - -<p>You can implement your tab content in one of two ways: use the tabs to swap -{@link android.view.View}s within the same {@link android.app.Activity}, or use the tabs to change -between entirely separate activities. Which method you want for your application will depend on your -demands, but if each tab provides a distinct user activity, then it probably makes sense to use -a separate {@link android.app.Activity} for each tab, so that you can better manage the application -in discrete groups, rather than one massive application and layout.</p> -<h2 id="example">Example</h2> -<p>In this tutorial, you'll create a tabbed UI that uses a separate {@link -android.app.Activity} for each tab.</p> - -<ol> - <li>Start a new project named <em>HelloTabWidget</em>.</li> - <li>First, create three separate {@link android.app.Activity} classes in your project: -<code>ArtistsActivity</code>, <code>AlbumsActivity</code>, and <code>SongsActivity</code>. These -will each represent a separate tab. For now, make each one display a simple message using a {@link -android.widget.TextView}. For example: -<pre> -public class ArtistsActivity extends Activity { - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - TextView textview = new TextView(this); - textview.setText("This is the Artists tab"); - setContentView(textview); - } -} -</pre> - <p>Notice that this doesn't use a layout file. Just create a {@link -android.widget.TextView}, give it some text and set that as the content. Duplicate this for -each of the three activities, and add the corresponding <code><activity/></code> tags to the Android Manifest file.</p> - - <li>You need an icon for each of your tabs. For each icon, you should create two versions: one -for when the tab is selected and one for when it is unselected. The -general design recommendation is for the selected icon to be a dark color (grey), and the -unselected icon to be a light color (white). (See the <a -href="{@docRoot}guide/practices/ui_guidelines/icon_design.html#tabstructure">Icon Design -Guidelines</a>.) For example: - <p> - <img src="images/ic_tab_artists_white.png" title="unselected tab icon" alt="" /> - <img src="images/ic_tab_artists_grey.png" title="selected tab icon" alt="" /> - </p> - <p>For this tutorial, you can copy these images and use them for all three tabs. (When you -create tabs in your own application, you should create customized tab icons.)</p> - <p>Now create a <a -href="{@docRoot}guide/topics/resources/drawable-resource.html#StateList">state-list drawable</a> -that specifies which image to use for each tab state:</p> - <ol> - <li>Save the icon images in your project <code>res/drawable/</code> directory.</li> - <li>Create a new XML file in <code>res/drawable/</code> -named <code>ic_tab_artists.xml</code> and insert the following: -<pre> -<?xml version="1.0" encoding="utf-8"?> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <!-- When selected, use grey --> - <item android:drawable="@drawable/ic_tab_artists_grey" - android:state_selected="true" /> - <!-- When not selected, use white--> - <item android:drawable="@drawable/ic_tab_artists_white" /> -</selector> -</pre> - <p>This is a <a -href="{@docRoot}guide/topics/resources/drawable-resource.html#StateList">state-list drawable</a>, -which you will apply as the tab image. When the tab state changes, the tab icon will -automatically switch between the images defined here.</p> - </li> - </ol> - </li> - - <li>Open the <code>res/layout/main.xml</code> file and insert the following: - <pre> -<?xml version="1.0" encoding="utf-8"?> -<TabHost xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@android:id/tabhost" - android:layout_width="fill_parent" - android:layout_height="fill_parent"> - <LinearLayout - android:orientation="vertical" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:padding="5dp"> - <TabWidget - android:id="@android:id/tabs" - android:layout_width="fill_parent" - android:layout_height="wrap_content" /> - <FrameLayout - android:id="@android:id/tabcontent" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:padding="5dp" /> - </LinearLayout> -</TabHost> -</pre> - <p>This is the layout that will display the tabs and provide navigation between each {@link - android.app.Activity} created above.</p> - <p>The {@link android.widget.TabHost} requires that a {@link android.widget.TabWidget} and a -{@link android.widget.FrameLayout} both live somewhere within it. To position the {@link -android.widget.TabWidget} and {@link android.widget.FrameLayout} vertically, a {@link -android.widget.LinearLayout} is used. The {@link android.widget.FrameLayout} is where the content -for each tab goes, which is empty now because the {@link android.widget.TabHost} will automatically -embed each {@link android.app.Activity} within it.</p> - <p>Notice that the {@link android.widget.TabWidget} and the {@link android.widget.FrameLayout} - elements have the IDs {@code tabs} and {@code tabcontent}, respectively. These names - must be used so that the {@link android.widget.TabHost} can retrieve references to each of - them. It expects exactly these names.</p> - </li> - - <li>Now open <code>HelloTabWidget.java</code> and make it extend {@link - android.app.TabActivity}:</p> -<pre> -public class HelloTabWidget extends TabActivity { -</pre> - </li> - <li>Use the following code for the {@link android.app.Activity#onCreate(Bundle) onCreate()} - method: -<pre> -public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.main); - - Resources res = getResources(); // Resource object to get Drawables - TabHost tabHost = getTabHost(); // The activity TabHost - TabHost.TabSpec spec; // Resusable TabSpec for each tab - Intent intent; // Reusable Intent for each tab - - // Create an Intent to launch an Activity for the tab (to be reused) - intent = new Intent().setClass(this, ArtistsActivity.class); - - // Initialize a TabSpec for each tab and add it to the TabHost - spec = tabHost.newTabSpec("artists").setIndicator("Artists", - res.getDrawable(R.drawable.ic_tab_artists)) - .setContent(intent); - tabHost.addTab(spec); - - // Do the same for the other tabs - intent = new Intent().setClass(this, AlbumsActivity.class); - spec = tabHost.newTabSpec("albums").setIndicator("Albums", - res.getDrawable(R.drawable.ic_tab_albums)) - .setContent(intent); - tabHost.addTab(spec); - - intent = new Intent().setClass(this, SongsActivity.class); - spec = tabHost.newTabSpec("songs").setIndicator("Songs", - res.getDrawable(R.drawable.ic_tab_songs)) - .setContent(intent); - tabHost.addTab(spec); - - tabHost.setCurrentTab(2); -} -</pre> - <p>This sets up each tab with their text and icon, and assigns each one an {@link -android.app.Activity}.</p> - <p>A reference to the {@link android.widget.TabHost} is first captured with {@link -android.app.TabActivity#getTabHost()}. Then, for -each tab, a {@link android.widget.TabHost.TabSpec} is created to define the tab properties. The -{@link android.widget.TabHost#newTabSpec(String)} method creates a new {@link -android.widget.TabHost.TabSpec} identified by the given string tag. For each -{@link android.widget.TabHost.TabSpec}, {@link -android.widget.TabHost.TabSpec#setIndicator(CharSequence,Drawable)} is called to set the text and -icon for the tab, and {@link android.widget.TabHost.TabSpec#setContent(Intent)} is called to specify -the {@link android.content.Intent} to open the appropriate {@link android.app.Activity}. Each -{@link android.widget.TabHost.TabSpec} is then added to the {@link android.widget.TabHost} by -calling {@link android.widget.TabHost#addTab(TabHost.TabSpec)}.</p> - - <p>At the very end, {@link - android.widget.TabHost#setCurrentTab(int)} opens the tab to be displayed by default, specified - by the index position of the tab.</p> - - <p>Notice that not once was the {@link android.widget.TabWidget} object referenced. This is - because a {@link android.widget.TabWidget} must always be a child of a {@link - android.widget.TabHost}, which is what you use for almost all interaction with the tabs. So when - a tab is added to the {@link android.widget.TabHost}, it's automatically added to the child - {@link android.widget.TabWidget}.</p> - </li> - - <li>Now open the Android Manifest file and add the <code>NoTitleBar</code> theme to the -<em>HelloTabWidget</em>'s - <code><activity></code> tag. This will remove the default application title from the top - of the layout, leaving more space for the tabs, which effectively operate as their own titles. - The <code><activity></code> tag should look like this: -<pre> -<activity android:name=".HelloTabWidget" android:label="@string/app_name" - android:theme="@android:style/Theme.NoTitleBar"> -</pre> - </li> - - <li>Run the application.</li> -</ol> - - -<p>Your application should look like this (though your icons may be different):</p> -<img src="images/hello-tabwidget.png" width="150px" /> - - diff --git a/docs/html/guide/topics/ui/notifiers/notifications.jd b/docs/html/guide/topics/ui/notifiers/notifications.jd index 05ec279..3b1292e 100644 --- a/docs/html/guide/topics/ui/notifiers/notifications.jd +++ b/docs/html/guide/topics/ui/notifiers/notifications.jd @@ -94,7 +94,7 @@ page.title=Notifications <p class="note"> <strong>Note:</strong> Except where noted, this guide refers to the {@link android.support.v4.app.NotificationCompat.Builder NotificationCompat.Builder} class - in the version 4 <a href="{@docRoot}tools/extras/support-library.html">Support Library</a>. + in the version 4 <a href="{@docRoot}tools/support-library/index.html">Support Library</a>. The class {@link android.app.Notification.Builder Notification.Builder} was added in Android 3.0. </p> @@ -285,7 +285,7 @@ page.title=Notifications <p> Starting an {@link android.app.Activity} when the user clicks the notification is the most common action scenario. You can also start an {@link android.app.Activity} when the user - dismisses an {@link android.app.Activity}. In Android 4.1 and later, you can start an + dismisses a notification. In Android 4.1 and later, you can start an {@link android.app.Activity} from an action button. To learn more, read the reference guide for {@link android.support.v4.app.NotificationCompat.Builder}. </p> |
