to top
Android APIs
Sample Code >

view - API Demos

← Back

RelativeLayout

1. Vertical
Demonstrates a simple relative layout.
2. Simple Form
Demonstrates a more complex relative layout to create a form.

LinearLayout

1. Vertical
Demonstrates a simple LinearLayout, with child width set to WRAP_CONTENT.
2. Vertical (Fill Screen)
Demonstrates a simple LinearLayout, with child width set to MATCH_PARENT.
3. Vertical (Padded)
Demonstrates a LinearLayout where one of the elements can expand to fill any remaining screen space (weight=1).
4. Horizontal
Demonstrates a horizontal LinearLayout, plus an expanding column.
5. Simple Form
Demonstrates nested layouts to create a user form.
6. Uniform Size
LinearLayout which uses a combination of wrap_content on itself and match_parent on its children to get every item to be the same width.
7. Fill Parent
Demonstrates a horizontal linear layout with equally sized columns. Some columns force their height to match the parent.
8. Gravity
Demonstrates a simple linear layout with menu options demonstrating horizontal and vertical gravity options.
9. Layout Weight
Demonstrates how the layout_weight attribute can shrink an element too big to fit on screen.

ScrollView

1. Short
Demonstrates scrolling screen with buttons altermating with a text view.
2. Long
Demonstrates a longer scrolling screen similar to ScrollView1.

TableLayout

1. Basic
Demonstrates a basic TableLayout with identical children.
2. Empty Cells
Demonstrates a TableLayout with column-spanning rows and different child objects.
3. Long Content
Rows have different number of columns and content doesn't fit on screen: column 4 of row 2 shrinks all of the other columns
4. Stretchable
Demonstrates a TableLayout with a stretchable column.
5. Spanning and Stretchable
Demonstrates a complex TableLayout with spanning columns and stretchable columns to create a menu-like layout.
6. More Spanning and Stretchable
Similar to example 5, but with an additional "checked" column.
7. Column Collapse
Similar to example 6, but now with buttons on the bottom of the screen that enable you dynamically hide or show columns.
8. Toggle Stretch
Demonstrates toggling the "stretch" value on a column to fill the screen width.
9. Toggle Shrink
Demonstrates toggling the "shrink" value on a column to make an over-wide table shrink to fit the screen size.
10. Simple Form
Demonstrates using a table to design a user form.
11. Gravity
Demonstrates the use of advanced gravity attributes, such as center_horizontal and right|bottom to align cell contents in a table.
12. Various Widths
Demonstrates the use of elements of various widths in a table.

Baseline

Demonstrates the use of the android:layout_alignBaseline XML attribute in various page layouts.

1. Top
Demonstrates the default baseline alignment in a simple LinearLayout with items at the top of the screen.
2. Bottom
Demonstrates the default baseline alignment in a simple LinearLayout with items at the bottom of the screen.
3. Center
Demonstrates the default baseline alignment in a simple LinearLayout with items in the center of the screen.
4. Everywhere
Demonstrates the default baseline alignment in a complex LinearLayout.
6. Multi-line
Demonstrates a baseline alignment with a multiline field.
7. Relative
Demonstrates baseline alignment in a RelativeLayout.
BaselineNested1
Demonstrates baseline aligning specific elements in three parallel vertical LinearLayout objects.
BaselineNested2
Demonstrates baseline aligning specific elements in three mixed vertical and horizontal LinearLayout objects.
BaselineNested3
Demonstrates baseline alignment within nested LinearLayout objects.

Radio Group

Radio Group
Demonstrates using radio buttons and capturing the selected item.

ScrollBars

1. Basic
Demonstrates a scrollable LinearLayout object.
2. Fancy
Demonstrates a scrollable LinearLayout object with a custom thumb slider image.

Visibility

Visibility
Demonstrates toggling the visibility of a View object between visible, invisible, and gone.

Lists

1. Array
Demonstrates binding a ListAdapter to a string array as a data source, and displaying the elements on the screen.
2. Cursor (People)
Demonstrates binding results from a database query to a field in a template.
3. Cursor (Phones)
Demonstrates binding multiple columns from a database query to fields in a template.
4. ListAdapter
Demonstrates implementing a custom ListAdapter to return View objects laid out in a custom manner.
5. Separators
Demonstrates implementing a custom ListAdapter that includes separators between some items.
6. ListAdapter Collapsed
Demonstrates another custom list adapter with that returns expandible items.
7. Cursor (Phones)
Demonstrates a list adapter where data comes from a Cursor object.
8. Photos
Demonstrates a list activity that uses a custom ListAdapter, setting the view for an empty item, and also how to customize the layout of a ListActivity.
9. Array (Overlay)
10. Single choice list
11. Multiple choice list
12. Transcript
13. Slow Adapter
14. Efficient Adapter
15. Selection Mode
Demonstrates the use of selection Contextual Action mode to select multiple items in a list activity.
16. Border selection mode
Demonstrates a multi-select list activity that uses the simple_selectable_list_item border layout for selected items.

Custom

CustomView
Demonstrates implementing a custom view subclass.

ImageButton

ImageButton
Demonstrates an ImageButton: a button with an arbitrary graphic on it.

Date Widgets

1. Dialog
Demonstrates the DatePickerDialog and TimePickerDialog picker dialogs.
2. Inline
Demonstrates using a TimePicker directly in a layout without using a confirmation button or dialog.

Gallery

1. Icons
Demonstrates implementing a Gallery widget and extending GalleryAdapter to create a custom class to serve out source images to the widget.
2. People
Demonstrates populating a Gallery with images from the contacts photos.

Spinner

Spinner
Demonstrates populating two Spinner widgets with values.

Grid

1. Icon Grid
Demonstrates populating a GridView widget with a list of applications using a custom ListAdapter object.
2. Photo Grid
Demonstrates populating a GridView widget with images using a custom ListAdapter object.

ImageSwitcher

ImageSwitcher
Demonstrates using the ImageSwitcher widget with a custom Adapter.

TextSwitcher

TextSwitcher
Demonstrates using the TextSwitcher widget.

Animation

1. Shake
Demonstrates a simple tweened animation (android.view.animation.Animation).
2. Push
Demonstrates a variety of transformations (android.view.animation.Animation), including fading, motion, and rotation.

Drag and Drop

Drag and Drop Demo
Demonstrates how to perform drag and drop using an OnDragListener. (Uses the DraggableDot class.)

Controls

1. Light Theme
Demonstrates a variety of common form type widgets, such as check boxes and radio buttons using the light theme.
2. Dark Theme
Demonstrates a variety of common form type widgets, such as check boxes and radio buttons using the dark theme.
3. Holographic Light Theme
Demonstrates a variety of common form type widgets, such as check boxes and radio buttons using the light holographic theme.
4. Holographic Dark Theme
Demonstrates a variety of common form type widgets, such as check boxes and radio buttons using the dark holographic theme.
5. Custom Theme
Demonstrates a variety of common form type widgets, such as check boxes and radio buttons using a custom theme based on the light theme.
6. Holo or Old Theme
Demonstrates a variety of common form type widgets, such as check boxes and radio buttons using a custom theme that uses either the traditional or holo theme depending on the version of the platform.

Auto Complete

1. Screen Top
Demonstrates the use of AutoCompleteTextView, an autocomplete dropdown box below a text box, with data taken from an array.
2. Screen Bottom
Demonstrates an autocomplete box above a text box.
3. Scroll
Demonstrates an autocomplete text box in the midst of a vertical list.
4. Contacts
Demonstrates an autocomplete text box that gets its content from a database query.
5. Contacts with Hint
Demonstates an autocomplete text box that understands the * wildcard.

Progress Bar

1. Incremental
Demonstrates large and small rotating progress indicators that can be incremented or decremented in units.
2. Smooth
Demonstrates large and small continuously rotating progress indicators used to indicate a generic "busy" message.
3. Dialogs
Demonstrates a ProgressDialog, a popup dialog that hosts a progress bar. This example demonstrates both determinate and indeterminate progress indicators.
4. In Title Bar
Demonstrates an Activity screen with a progress indicator loaded by setting the WindowPolicy's progress indicator feature.

Focus

1. Vertical
Demonstrates how to block selection of a specific screen element.
2. Horizontal
Demonstrates how to change the order of which screen element is selected when the user presses arrow keys.
3. Circular
Another version of Focus2.

Files