diff --git a/docs/html/guide/guide_toc.cs b/docs/html/guide/guide_toc.cs index e812ccbc7b251..46c4398c06991 100644 --- a/docs/html/guide/guide_toc.cs +++ b/docs/html/guide/guide_toc.cs @@ -191,28 +191,21 @@
Figure 1. Notifications in the notification area.
+ height="293" alt="" />
Figure 2. Notifications in the notification drawer.
@@ -98,7 +114,7 @@ page.title=Notifications
Figure 3. Notification in normal view. diff --git a/docs/html/guide/topics/ui/notifiers/toasts.jd b/docs/html/guide/topics/ui/notifiers/toasts.jd index 1a1fb1ff875b5..92c146a742ae9 100644 --- a/docs/html/guide/topics/ui/notifiers/toasts.jd +++ b/docs/html/guide/topics/ui/notifiers/toasts.jd @@ -1,17 +1,8 @@ -page.title=Toast Notifications -parent.title=Notifications -parent.link=index.html +page.title=Toasts @jd:body
A toast notification is a message that pops up on the surface of the window. -It only fills the amount of space required for the message and the user's current -activity remains visible and interactive. The notification automatically fades in and -out, and does not accept interaction events.
+A toast provides simple feedback about an operation in a small popup. +It only fills the amount of space required for the message and the current +activity remains visible and interactive. +For example, navigating away from an email before you send it triggers a +"Draft saved" toast to let you know that you can continue editing later. +Toasts automatically disappear after a timeout.
-The screenshot below shows an example toast notification from the Alarm application. -Once an alarm is turned on, a toast is displayed to assure you that the -alarm was set.
-A toast can be created and displayed from an {@link android.app.Activity} or -{@link android.app.Service}. If you create a toast notification from a Service, it -appears in front of the Activity currently in focus.
- -If user response to the notification is required, consider using a -Status Bar Notification.
+If user response to a status message is required, consider instead using a +Notification.
-
If a simple text message isn't enough, you can create a customized layout for your toast notification. To create a custom layout, define a View layout, in XML or in your application code, and pass the root {@link android.view.View} object @@ -105,17 +89,17 @@ with the following XML (saved as toast_layout.xml):
android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" - android:padding="10dp" + android:padding="8dp" android:background="#DAAA" > - <ImageView android:id="@+id/image" + <ImageView android:src="@drawable/droid" android:layout_width="wrap_content" - android:layout_height="fill_parent" - android:layout_marginRight="10dp" + android:layout_height="wrap_content" + android:layout_marginRight="8dp" /> <TextView android:id="@+id/text" android:layout_width="wrap_content" - android:layout_height="fill_parent" + android:layout_height="wrap_content" android:textColor="#FFF" /> </LinearLayout> @@ -126,13 +110,11 @@ ID to inflate the layout from the XML, as shown here:
LayoutInflater inflater = getLayoutInflater();
-View layout = inflater.inflate(R.layout.toast_layout,
+View layout = inflater.inflate(R.layout.custom_toast,
(ViewGroup) findViewById(R.id.toast_layout_root));
-ImageView image = (ImageView) layout.findViewById(R.id.image);
-image.setImageResource(R.drawable.android);
TextView text = (TextView) layout.findViewById(R.id.text);
-text.setText("Hello! This is a custom toast!");
+text.setText("This is a custom toast");
Toast toast = new Toast(getApplicationContext());
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
diff --git a/docs/html/images/toast.png b/docs/html/images/toast.png
index 223048a396143..b4c709ac2b48c 100644
Binary files a/docs/html/images/toast.png and b/docs/html/images/toast.png differ
diff --git a/docs/html/images/ui/notifications/iconic_notification.png b/docs/html/images/ui/notifications/iconic_notification.png
index 4cabfdbe0a445..e72fe4e86b1b9 100644
Binary files a/docs/html/images/ui/notifications/iconic_notification.png and b/docs/html/images/ui/notifications/iconic_notification.png differ
diff --git a/docs/html/images/ui/notifications/normal_notification.png b/docs/html/images/ui/notifications/normal_notification.png
index 3cf02311be4cf..9bea5fb5196d8 100644
Binary files a/docs/html/images/ui/notifications/normal_notification.png and b/docs/html/images/ui/notifications/normal_notification.png differ
diff --git a/docs/html/images/ui/notifications/normal_notification_callouts.png b/docs/html/images/ui/notifications/normal_notification_callouts.png
index db57dafbe0f22..6880e90c0f96a 100644
Binary files a/docs/html/images/ui/notifications/normal_notification_callouts.png and b/docs/html/images/ui/notifications/normal_notification_callouts.png differ