Merge "docs: InfoPros, Project 02, Batch 03" into mnc-mr-docs
This commit is contained in:
committed by
Android (Google) Code Review
commit
d00f005049
@@ -25,8 +25,6 @@ screen configuration</li>
|
||||
<ol>
|
||||
<li><a
|
||||
href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a></li>
|
||||
<li><a
|
||||
href="{@docRoot}guide/practices/optimizing-for-3.0.html">Optimizing Apps for Android 3.0</a></li>
|
||||
</ol>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -8,7 +8,7 @@ page.title=Animation and Graphics Overview
|
||||
<h3 id="animation">Animation</h3>
|
||||
|
||||
<p>The Android framework provides two animation systems: property animation
|
||||
(introduced in Android 3.0) and view animation. Both animation systems are viable options,
|
||||
and view animation. Both animation systems are viable options,
|
||||
but the property animation system, in general, is the preferred method to use, because it
|
||||
is more flexible and offers more features. In addition to these two systems, you can utilize Drawable
|
||||
animation, which allows you to load drawable resources and display them one frame after
|
||||
|
||||
@@ -458,8 +458,8 @@ public class MediaRouterPlaybackActivity extends ActionBarActivity {
|
||||
<p class="note">
|
||||
<strong>Note:</strong> In order for Wireless Display routes to show up in the media route
|
||||
selection dialog, users must enable this option in the Settings app. The option is under
|
||||
the <em>Display</em> category and is called <em>Cast screen</em> on Android 4.4 (KitKat) and higher
|
||||
devices and <em>Wireless Display</em> on Android 4.2.x (Jelly Bean) devices. For more information
|
||||
the <em>Display</em> category and is called <em>Cast screen</em> on Android 4.4 (KitKat)
|
||||
and higher devices. For more information
|
||||
on enabling this feature see this
|
||||
<a href="https://support.google.com/nexus/answer/2865484">Wireless display</a> support page.
|
||||
</p>
|
||||
|
||||
@@ -300,8 +300,7 @@ public void onGroupItemClick(MenuItem item) {
|
||||
// All other menu item clicks are handled by {@link android.app.Activity#onOptionsItemSelected onOptionsItemSelected()}
|
||||
}
|
||||
</pre>
|
||||
<p class="note"><strong>Note:</strong> The {@code android:showAsAction} attribute is
|
||||
available only on Android 3.0 (API Level 11) and greater.</p>
|
||||
|
||||
</dd> <!-- end example -->
|
||||
|
||||
|
||||
|
||||
@@ -102,8 +102,7 @@ handle searches. The dialog can also provide search suggestions while the user t
|
||||
you can place anywhere in your layout. By default, the search widget behaves like a standard {@link
|
||||
android.widget.EditText} widget and doesn't do anything, but you can configure it so that the
|
||||
Android system handles all input events, delivers queries to the appropriate activity, and provides
|
||||
search suggestions (just like the search dialog). However, the search widget is available only in
|
||||
Android 3.0 (API Level 11) and higher.
|
||||
search suggestions (just like the search dialog).
|
||||
|
||||
<p class="note"><strong>Note:</strong> If you want, you can handle all user input into the
|
||||
search widget yourself, using various callback methods and listeners. This document, however,
|
||||
@@ -376,30 +375,13 @@ for an a complete demonstration of how to search an SQLite database and use an
|
||||
|
||||
<h2 id="SearchDialog">Using the Search Dialog</h2>
|
||||
|
||||
<div class="sidebox-wrapper">
|
||||
<div class="sidebox">
|
||||
<h2>Should I use the search dialog or the widget?</h2>
|
||||
<p>The answer depends mostly on whether you are developing for Android 3.0 (API Level 11 or
|
||||
higher), because the {@link android.widget.SearchView} widget was introduced in Android 3.0. So,
|
||||
if you are developing your application for a version of Android lower than 3.0, the search widget is
|
||||
not an option and you should use the search dialog to implement your search interface.</p>
|
||||
<p>If you <em>are</em> developing for Android 3.0 or higher, then the decision depends more on
|
||||
your needs. In most cases, we recommend that you use the search widget as an "action view" in the
|
||||
Action Bar. However, it might not be an option for you to put the search
|
||||
widget in the Action Bar for some reason (perhaps there's not enough space or you don't use the
|
||||
Action Bar). So, you might instead want to put the search widget somewhere in your activity layout.
|
||||
And if all else fails, you can still use the search dialog if you prefer to keep the search box
|
||||
hidden. In fact, you might want to offer both the dialog and the widget in some cases. For more
|
||||
information about the widget, skip to <a href="#UsingSearchWidget">Using the Search Widget</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>The search dialog provides a floating search box at the top of the screen, with the application
|
||||
icon on the left. The search dialog can provide search suggestions as the user types and, when
|
||||
the user executes a search, the system sends the search query to a
|
||||
searchable activity that performs the search. However, if you are developing
|
||||
your application for devices running Android 3.0, you should consider using the search widget
|
||||
instead (see the side box).</p>
|
||||
instead (see <a href="#UsingSearchWidget">Using the Search Widget</a> section).</p>
|
||||
|
||||
<p>The search dialog is always hidden by default, until the user activates it. Your application
|
||||
can activate the search dialog by calling {@link
|
||||
@@ -685,14 +667,14 @@ layout). For example, figure 2 shows the search widget in the app bar.</p>
|
||||
|
||||
<p>The search widget provides the same functionality as the search dialog. It starts the appropriate
|
||||
activity when the user executes a search, and it can provide search suggestions and perform voice
|
||||
search.</p>
|
||||
search. If it's not an option for you to put the search widget in the Action Bar, you can instead
|
||||
put the search widget somewhere in your activity layout.</p>
|
||||
|
||||
<p class="note"><strong>Note:</strong> When you use the search widget as an action view, you
|
||||
still might need to support using the search dialog, for cases in which the search widget does
|
||||
not fit in the Action Bar. See the following section about <a href="#UsingBoth">Using both
|
||||
the widget and the dialog</a>.</p>
|
||||
|
||||
|
||||
<h3 id="ConfiguringWidget">Configuring the search widget</h3>
|
||||
|
||||
<p>After you've created a <a href="#SearchableConfiguration">searchable configuration</a> and a <a
|
||||
|
||||
@@ -532,21 +532,12 @@ ViewCompat.setAccessibilityDelegate(new AccessibilityDelegateCompat() {
|
||||
}
|
||||
</pre>
|
||||
|
||||
<p>In applications targeting Android 4.0 (API Level 14) and higher, you can implement these methods
|
||||
<p>You can implement these methods
|
||||
directly in your custom view class. For another example of this approach, see the Android
|
||||
<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>
|
||||
|
||||
<p class="note"><strong>Note:</strong> You may find information on implementing accessibility for
|
||||
custom views written prior to Android 4.0 that describes the use of the
|
||||
{@link android.view.View#dispatchPopulateAccessibilityEvent dispatchPopulateAccessibilityEvent()}
|
||||
method for populating AccessibilityEvents. As of the Android 4.0 release, however, the recommended
|
||||
approach is to use the
|
||||
{@link android.view.View#onPopulateAccessibilityEvent onPopulateAccessibilityEvent()} and
|
||||
{@link android.view.View#onInitializeAccessibilityEvent onInitializeAccessibilityEvent()}
|
||||
methods.</p>
|
||||
|
||||
|
||||
<h3 id="virtual-hierarchy">Providing a customized accessibility context</h3>
|
||||
|
||||
|
||||
@@ -409,7 +409,7 @@ public class MyAccessibilityService extends AccessibilityService {
|
||||
<h3 id="focus-types">Using focus types</h3>
|
||||
|
||||
<p>Android 4.1 (API Level 16) introduces a new type of user interface focus called <em>Accessibility
|
||||
Focus</em>. This type of focus can be used by accessibility services to select any visible user
|
||||
Focus</em>. Accessibility services can used this type of focus to select any visible user
|
||||
interface element and act on it. This focus type is different from the more well known <em>Input
|
||||
Focus</em>, which determines what on-screen user interface element receives input when a user
|
||||
types characters, presses <strong>Enter</strong> on a keyboard or pushes the center button of a
|
||||
|
||||
@@ -170,10 +170,6 @@ android.support.v4.app.DialogFragment}, you need to define a fragment class that
|
||||
android.support.v4.app.DialogFragment} and return a {@link android.app.DatePickerDialog} from the
|
||||
fragment's {@link android.support.v4.app.DialogFragment#onCreateDialog onCreateDialog()} method.</p>
|
||||
|
||||
<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/support-library/setup.html">Setting Up a Project to Use a
|
||||
Library</a>.</p>
|
||||
|
||||
<h3 id="DatePickerFragment">Extending DialogFragment for a date picker</h3>
|
||||
|
||||
@@ -250,9 +246,4 @@ android.support.v4.app.DialogFragment} defined above. The {@link
|
||||
android.support.v4.app.DialogFragment#show show()} method requires an instance of {@link
|
||||
android.support.v4.app.FragmentManager} and a unique tag name for the fragment.</p>
|
||||
|
||||
<p class="caution"><strong>Caution:</strong> If your app supports versions of Android lower than
|
||||
3.0, be sure that you call {@link
|
||||
android.support.v4.app.FragmentActivity#getSupportFragmentManager()} to acquire an instance of
|
||||
{@link android.support.v4.app.FragmentManager}. Also make sure that your activity that displays the
|
||||
time picker extends {@link android.support.v4.app.FragmentActivity} instead of the standard {@link
|
||||
android.app.Activity} class.</p>
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ set the width or height: </p>
|
||||
<ul>
|
||||
<li><var>wrap_content</var> tells your view to size itself to the dimensions
|
||||
required by its content.</li>
|
||||
<li><var>match_parent</var> (named <var>fill_parent</var> before API Level 8)
|
||||
<li><var>match_parent</var>
|
||||
tells your view to become as big as its parent view group will allow.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
@@ -75,14 +75,6 @@ versions of Android:</p>
|
||||
<dd>The <a href="#options-menu">options menu</a> is the primary collection of menu items for an
|
||||
activity. It's where you should place actions that have a global impact on the app, such as
|
||||
"Search," "Compose email," and "Settings."
|
||||
<p>If you're developing for Android 2.3 or lower, users can
|
||||
reveal the options menu panel by pressing the <em>Menu</em> button.</p>
|
||||
<p>On Android 3.0 and higher, items from the options menu are presented by the
|
||||
app bar as a combination of on-screen action
|
||||
items and overflow options. Beginning with Android 3.0, the <em>Menu</em> button is deprecated (some
|
||||
devices
|
||||
don't have one), so you should migrate toward using the action bar to provide access to actions and
|
||||
other options.</p>
|
||||
<p>See the section about <a href="#options-menu">Creating an Options Menu</a>.</p>
|
||||
</dd>
|
||||
|
||||
@@ -91,8 +83,7 @@ other options.</p>
|
||||
<dd>A context menu is a <a href="#FloatingContextMenu">floating menu</a> that appears when the
|
||||
user performs a long-click on an element. It provides actions that affect the selected content or
|
||||
context frame.
|
||||
<p>When developing for Android 3.0 and higher, you should instead use the <a
|
||||
href="#CAB">contextual action mode</a> to enable actions on selected content. This mode displays
|
||||
<p>The <a href="#CAB">contextual action mode</a> displays
|
||||
action items that affect the selected content in a bar at the top of the screen and allows the user
|
||||
to select multiple items.</p>
|
||||
<p>See the section about <a href="#context-menu">Creating Contextual Menus</a>.</p>
|
||||
@@ -278,8 +269,8 @@ properties with {@link android.view.MenuItem} APIs.</p>
|
||||
|
||||
<p>If you've developed your application for Android 2.3.x and lower, the system calls {@link
|
||||
android.app.Activity#onCreateOptionsMenu(Menu) onCreateOptionsMenu()} to create the options menu
|
||||
when the user opens the menu for the first time. If you've developed for Android 3.0 and higher, the
|
||||
system calls {@link android.app.Activity#onCreateOptionsMenu(Menu) onCreateOptionsMenu()} when
|
||||
when the user opens the menu for the first time. If you've developed for Android 3.0 and higher,
|
||||
the system calls {@link android.app.Activity#onCreateOptionsMenu(Menu) onCreateOptionsMenu()} when
|
||||
starting the activity, in order to show items to the app bar.</p>
|
||||
|
||||
|
||||
@@ -504,10 +495,6 @@ associated with the app bar. They operate
|
||||
independently, even though the contextual action bar visually overtakes the app bar
|
||||
position.</p>
|
||||
|
||||
<p>If you're developing for Android 3.0 (API level 11) or higher, you
|
||||
should usually use the contextual action mode to present contextual actions, instead of the <a
|
||||
href="#FloatingContextMenu">floating context menu</a>.</p>
|
||||
|
||||
<p>For views that provide contextual actions, you should usually invoke the contextual action mode
|
||||
upon one of two events (or both):</p>
|
||||
<ul>
|
||||
@@ -737,13 +724,12 @@ level 11 and higher.</p>
|
||||
|
||||
<p>If you <a href="#xml">define your menu in XML</a>, here's how you can show the popup menu:</p>
|
||||
<ol>
|
||||
<li>Instantate a {@link android.widget.PopupMenu} with its constructor, which takes the
|
||||
<li>Instantiate a {@link android.widget.PopupMenu} with its constructor, which takes the
|
||||
current application {@link android.content.Context} and the {@link android.view.View} to which the
|
||||
menu should be anchored.</li>
|
||||
<li>Use {@link android.view.MenuInflater} to inflate your menu resource into the {@link
|
||||
android.view.Menu} object returned by {@link
|
||||
android.widget.PopupMenu#getMenu() PopupMenu.getMenu()}. On API level 14 and above, you can use
|
||||
{@link android.widget.PopupMenu#inflate PopupMenu.inflate()} instead.</li>
|
||||
android.widget.PopupMenu#getMenu() PopupMenu.getMenu()}.</li>
|
||||
<li>Call {@link android.widget.PopupMenu#show() PopupMenu.show()}.</li>
|
||||
</ol>
|
||||
|
||||
|
||||
@@ -95,9 +95,9 @@ The class {@link android.app.Notification.Builder Notification.Builder} was adde
|
||||
|
||||
<p>Notifications, as an important part of the Android user interface, have their own design guidelines.
|
||||
The material design changes introduced in Android 5.0 (API level 21) are of particular
|
||||
importance, and you should review the <a href="{@docRoot}training/material/index.html">Material Design</a>
|
||||
training for more information. To learn how to design notifications and their interactions, read the
|
||||
<a href="{@docRoot}design/patterns/notifications.html">Notifications</a> design guide.</p>
|
||||
importance, and you should review the <a href="{@docRoot}training/material/index.html">Material
|
||||
Design</a> training for more information. To learn how to design notifications and their interactions,
|
||||
read the <a href="{@docRoot}design/patterns/notifications.html">Notifications</a> design guide.</p>
|
||||
|
||||
<h2 id="CreateNotification">Creating a Notification</h2>
|
||||
|
||||
@@ -326,8 +326,8 @@ mBuilder.setStyle(inBoxStyle);
|
||||
<a href="{@docRoot}design/patterns/notifications.html">Notifications</a> Design guide.
|
||||
</p>
|
||||
<p class="note">
|
||||
<strong>Note:</strong> This Gmail feature requires the "inbox" expanded layout, which is
|
||||
part of the expanded notification feature available starting in Android 4.1.
|
||||
<strong>Note:</strong> This Gmail feature requires the "inbox" expanded layout, which is part
|
||||
of the expanded notification feature.
|
||||
</p>
|
||||
<p>
|
||||
The following section describes how to update notifications and also how to remove them.
|
||||
@@ -892,7 +892,8 @@ based on the {@link android.media.RemoteControlClient}, which is now deprecated.
|
||||
{@link android.app.Notification.Builder#addAction(android.app.Notification.Action) addAction()}
|
||||
method, which converts actions into clickable icons.</p>
|
||||
|
||||
<p class="note"><strong>Note:</strong> The template and the {@link android.app.Notification.Builder#addAction(android.app.Notification.Action) addAction()}
|
||||
<p class="note"><strong>Note:</strong> The template and the
|
||||
{@link android.app.Notification.Builder#addAction(android.app.Notification.Action) addAction()}
|
||||
method are not included in the support library, so these features run in Android 5.0 and higher
|
||||
only.</p>
|
||||
|
||||
|
||||
@@ -549,7 +549,7 @@ values with the defaults.</p>
|
||||
<p>In rare cases, you might want to design your settings such that the first screen
|
||||
displays only a list of <a href="#Subscreens">subscreens</a> (such as in the system Settings app,
|
||||
as shown in figures 4 and 5). When you're developing such a design for Android 3.0 and higher, you
|
||||
should use a new "headers" feature in Android 3.0, instead of building subscreens with nested
|
||||
should use the "headers" feature instead of building subscreens with nested
|
||||
{@link android.preference.PreferenceScreen} elements.</p>
|
||||
|
||||
<p>To build your settings with headers, you need to:</p>
|
||||
@@ -719,7 +719,7 @@ Android 3.0 ({@code res/xml/preference_headers_legacy.xml}):</p>
|
||||
|
||||
<p>Because support for {@code <preference-headers>} was added in Android 3.0, the system calls
|
||||
{@link android.preference.PreferenceActivity#onBuildHeaders onBuildHeaders()} in your {@link
|
||||
android.preference.PreferenceActivity} only when running on Androd 3.0 or higher. In order to load
|
||||
android.preference.PreferenceActivity} only when running on Android 3.0 or higher. In order to load
|
||||
the "legacy" headers file ({@code preference_headers_legacy.xml}), you must check the Android
|
||||
version and, if the version is older than Android 3.0 ({@link
|
||||
android.os.Build.VERSION_CODES#HONEYCOMB}), call {@link
|
||||
|
||||
@@ -302,17 +302,12 @@ adb -s emulator-5554 install <em>path/to/your/app</em>.apk
|
||||
device:</p>
|
||||
|
||||
<ul>
|
||||
<li>Enable <strong>USB debugging</strong> on your device.
|
||||
<ul>
|
||||
<li>On most devices running Android 3.2 or older, you can find the option under
|
||||
<strong>Settings > Applications > Development</strong>.</li>
|
||||
<li>On Android 4.0 and newer, it's in <strong>Settings > Developer options</strong>.
|
||||
<li>Enable <strong>USB debugging</strong> on your device. You can find the option under
|
||||
<strong>Settings > Developer options</strong>.
|
||||
<p class="note"><strong>Note:</strong> On Android 4.2 and newer, <strong>Developer
|
||||
options</strong> is hidden by default. To make it available, go
|
||||
to <strong>Settings > About phone</strong> and tap <strong>Build number</strong>
|
||||
seven times. Return to the previous screen to find <strong>Developer options</strong>.</p>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li>Ensure that your development computer can detect your device when connected via USB</li>
|
||||
|
||||
@@ -59,10 +59,10 @@ access on the phone, which let you:</p>
|
||||
<li>Plus many more options to simulate app stresses or enable debugging options.</li>
|
||||
</ul>
|
||||
<p>To access these settings, open the <em>Developer options</em> in the
|
||||
system Settings. On Android 4.2 and higher, the Developer options screen is
|
||||
system Settings. On Android 4.2 and higher, the <strong>Developer options</strong> screen is
|
||||
hidden by default. To make it visible, go to
|
||||
<b>Settings > About phone</b> and tap <b>Build number</b> seven times. Return to the previous
|
||||
screen to find Developer options at the bottom.</p>
|
||||
screen to find <strong>Developer options</strong> at the bottom.</p>
|
||||
|
||||
|
||||
|
||||
@@ -89,17 +89,12 @@ the <code><application></code> element.</p>
|
||||
<p class="note"><strong>Note:</strong> If you manually enable debugging in the manifest
|
||||
file, be sure to disable it in your release build (your published application
|
||||
should usually <em>not</em> be debuggable).</p></li>
|
||||
<li>Enable <strong>USB debugging</strong> on your device.
|
||||
<ul>
|
||||
<li>On most devices running Android 3.2 or older, you can find the option under
|
||||
<strong>Settings > Applications > Development</strong>.</li>
|
||||
<li>On Android 4.0 and newer, it's in <strong>Settings > Developer options</strong>.
|
||||
<p class="note"><strong>Note:</strong> On Android 4.2 and newer, <strong>Developer
|
||||
<li>Enable <strong>USB debugging</strong> on your device by going to
|
||||
<strong>Settings > Developer options</strong>.
|
||||
<p class="note"><strong>Note:</strong> On Android 4.2 and newer, <strong>Developer
|
||||
options</strong> is hidden by default. To make it available, go
|
||||
to <strong>Settings > About phone</strong> and tap <strong>Build number</strong>
|
||||
seven times. Return to the previous screen to find <strong>Developer options</strong>.</p>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Set up your system to detect your device.
|
||||
<ul>
|
||||
|
||||
@@ -111,8 +111,8 @@ page.tags=studio,templates,firstapp
|
||||
<p>This template includes:</p>
|
||||
|
||||
<ul>
|
||||
<li>Title bar ({@link android.app.ActionBar} on Android 3.0 and later)</li>
|
||||
<li>Options menu (action overflow on Android 3.0 and later) </li>
|
||||
<li>{@link android.app.ActionBar}</li>
|
||||
<li>Action overflow</li>
|
||||
<li>Basic layout</li>
|
||||
</ul>
|
||||
</td>
|
||||
|
||||
@@ -158,7 +158,7 @@ accessibility testing.</p>
|
||||
the Explore by Touch system feature. The TalkBack accessibility service comes preinstalled on most
|
||||
Android devices and can also be downloaded for free from
|
||||
<a href="https://play.google.com/store/apps/details?id=com.google.android.marvin.talkback">Google
|
||||
Play</a>. The Explore by Touch system feature is available on devices running Android 4.0 and later.
|
||||
Play</a>.
|
||||
</p>
|
||||
|
||||
<h4 id="testing-talkback">Testing with TalkBack</h4>
|
||||
@@ -192,7 +192,7 @@ focus navigation and audible prompts.</p>
|
||||
hover events over user interface controls.
|
||||
</p>
|
||||
|
||||
<p>To enable Explore by Touch on Android 4.0 and later:</p>
|
||||
<p>To enable Explore by Touch:</p>
|
||||
<ol>
|
||||
<li>Launch the <strong>Settings</strong> application.</li>
|
||||
<li>Navigate to the <strong>Accessibility</strong> category and select it.</li>
|
||||
@@ -239,7 +239,7 @@ option is not available.</p>
|
||||
than keyboards and D-pads. While gestures allow users to focus on nearly any on-screen
|
||||
content, keyboard and D-pad navigation only allow focus on input fields and buttons.</p>
|
||||
|
||||
<p>To enable gesture navigation on Android 4.1 and later:</p>
|
||||
<p>To enable gesture navigation:</p>
|
||||
<ul>
|
||||
<li>Enable both TalkBack and the Explore by Touch feature as described in the
|
||||
<a href="#testing-ebt">Testing with Explore by Touch</a>. When <em>both</em> of these
|
||||
|
||||
Reference in New Issue
Block a user