ITEEDU

UI Elements and Concepts Glossary

Here is a list of common UI elements and concepts that you will see here and elsewhere in the SDK.

Activity
The standard screen in an Android application. Activity is a class that Android can start when a matching Intent is thrown by this or another application. Most commonly, it is visibly represented by a full screen window that can receive and handle UI events and perform complex tasks, because of the Window it uses to render its window. Though an Activity is typically full screen, it can also be floating or transparent.
View
A rectangular area on the screen that can be drawn to, handles click, keystroke, and other interaction events. A View is a base class for most components of an Activity or Dialog screen (text boxes, windows, and so on). It receives calls from its container object to draw itself, and informs its parent object about where and how big it would like to be (which may or may not be respected by the parent). It is represented by the base class View.
View Group
A container that holds multiple child View objects, deciding where they will be and how large they can be, and calling on them to draw themselves when appropriate. Some are invisible and for layout only, while others have a UI themselves (for instance, scrolling list boxes). View groups are all in the widget package, but extend ViewGroup.
Widget
A form element, such as a text box or popup menu. They have the ability to draw themselves and handle UI events. Widgets are all in the widget package.
Drawable
A visual element that is loaded into another UI element, typically as a background image. It does not receive events, but does assign various other properties such as "state" and scheduling to enable subclasses such as animation objects or image libraries. Many drawable objects are loaded from resource files — xml or bitmap files that describe the image. The base class is Drawable. See Resources.
Panel
A panel is a concept not backed by a specific class. It is a View of some sort that is tied in closely to a parent window, but can handle clicks and perform simple functions related to its parent. A panel floats in front of its parent, and is positioned relative to it. A common example of a panel (implemented by Android) is the options menu available to every screen. At present, there are no specific classes or methods for creating a panel — it's more of a general idea.
Dialog
A dialog is a floating window that can have buttons, and acts as a lightweight form that is intended to, at most, perform a simple action (such as click a button) and perhaps return a value. It is not intended to persist in the history stack, contain complex layout, or perform complex actions. Android provides a default simple dialog for you with optional buttons, though you can define a dialog layout yourself. The base class is Dialog.
Window
An abstract class that specifies the elements of a generic window, such as the look and feel (title bar text, location and content of menus, and so on). Dialog and Activity use an implementation of this class to render a window. You should not need to implement this class.
Surface
A block of memory that gets composited to the screen. A Surface holds a Canvas object for drawing, and provides various helper methods to draw layers and resize the surface. You should not use this class directly; use SurfaceView instead.
SurfaceView
A View object that wraps a Surface for drawing, and exposes methods to specify its size and format dynamically. The camera app uses SurfaceView for its preview screen. A SurfaceView provides a way to draw independently of the UI thread for resource-intense operations (such as games or camera previews), but it uses extra memory as a result. SurfaceView supports both Canvas and OpenGL ES graphics.
Canvas
A drawing surface where the actual bits are composited. It has methods for standard computer drawing of bitmaps, lines, circles, rectangles, text, and so on. It is bound to a Bitmap or Surface. Canvas is the simplest, easiest way to draw 2D objects on the screen. However, it does not support hardware acceleration, as OpenGL ES does.
OpenGL ES
Android provides OpenGL ES libraries that you can use for fast, complex 3D images. It is harder to use than a Canvas object, but better for 3D objects. The opengl and javax.microedition.khronos.opengles packages expose OpenGL ES functionality.