1.app - API Demos / 실행사진, 소스 추가 (2010/06/11)
Activity 액티비티
- Hello World
- Demonstrates a basic screen activity.
- Code:
- HelloWorld.java
- Layout:
- hello_world.xml
- Save & Restore State
- Demonstrates how an activity should save state when it is paused.
- Persistent State
- Demonstrates how you can save and restore preferences, which are stored even after the user closes the application.
- Receive Result
- Demonstrates how an activity screen can return a result to the activity that opened it.
- Forwarding
- Demonstrates opening a new activity and removing the current activity from the history stack, so that when the user later presses BACK they will not see the intermediate activity.
- Redirection
- Demonstrates how to save data to preferences and use it to determine which activity to open next.
Translucent / 실행시 밑에 내용이 안보이게
- Demonstrates how to make an activity with a transparent background.
- TranslucentBlur // 실행시 밑에 내용이 약간 보이게..
- Demonstrates how to make an activity with a transparent background with a special effect (blur).
Service 서비스
- Local Service Controller
- Starts and stops the service class LocalService that runs in the same process as the activity, to demonstrate a service's lifecycle when using {@link android.content.Context#startService Context.startService} and {@link android.content.Context#stopService Context.stopService}.
- Local Service Binding
- Demonstrates binding to a service class LocalService that runs in the same process as the activity, to demonstrate using the {@link android.content.Context#bindService Context.bindService} and {@link android.content.Context#unbindService Context.unindService} methods with a service. This also shows how you can simplify working with a service when you know it will only run in your own process.
- Remote Service Controller
- Demonstrates starting a service in a separate process, by assigning
android:process=":remote"
to the service in the AndroidManifest.xml file. - Remote Service Binding
- Demonstrates binding to a remote service, similar to the Local Service Binding sample, but illustrating the additional work (defining aidl interfaces) needed to interact with a service in another process. Also shows how a service can publish multiple interfaces and implement callbacks to its clients.
- Service Start Arguments Controller
- Demonstrates how you can use a Service as a job queue, where you submit jobs to it with {@link android.content.Context#startService Context.startService} instead of binding to the service. Such a service automatically stops itself once all jobs have been processed. This can be a very convenient way to interact with a service when you do not need a result back from it.
- Code:
- ServiceStartArgumentsController.java
- ServiceStartArguments.java
- Layout:
- service_start_arguments_controller.xml
- Foreground Service Controller
- Controls the service class ForegroundService, which shows how you can write a Service that runs in the foreground and works on both pre-2.0 and post-2.0 versions of the platform. This example will selectively use the new foreground APIs that were introduced in Android 2.0 if they are available.
Alarm 알람 - sleep상태에서도 작동하게 해주는....
- Alarm Controller
- Demonstrates two ways you can schedule alarms: a one-shot alarm that will happen once at a given time, and a repeating alarm that will happen first at a given time and then continually trigger at regular intervals after that.
- Code:
- AlarmController.java
- OneShotAlarm.java
- RepeatingAlarm.java
- Layout:
- alarm_controller.xml
- Alarm Service
- Demonstrates how you can schedule an alarm that causes a service to be started. This is useful when you want to schedule alarms that initiate long-running operations, such as retrieving recent e-mails.
- Code:
- AlarmService.java
- AlarmService_Service.java
- Layout:
- alarm_service.xml
Notification 공지 노티
- NotifyWithText
- Demonstrates popup notifications of varying length.
- IncomingMessage
- Demonstrates sending persistent and transient notifications, with a View object in the notification. It also demonstrated inflating a View object from an XML layout resource.
Search 검색
- SearchInvoke
- Demonstrates various ways in which activities can launch the Search UI.
- SearchQueryResults
- Demonstrates an activity that receives Search intents and handles them.
- SearchSuggestionSampleProvider
- Demonstrates how to configure and use the built-in "recent queries" suggestion provider.
2. appwidget - API Demos
Files 위젯
3.content - API Demos 컨텐츠
Resources
- Styled Text 스타일 텍스트
- Demonstrates loading styled text (bold, italic) defined in a resource file.
- Resources 리소스
- Demonstrates loading styled strings from a resource file, and extracting the raw text.
4.Graphics - API Demos
Drawable 이미지
OpenGL 오픈지엘
- CameraPreview
- Demonstrates capturing the image stream from the camera, drawing to a surface (extending SurfaceView) on a separate thread (extending Thread).
-
- GL SurfaceView
- Demonstrates how to perform OpenGL rendering in to a SurfaceView.
- Code:
- GLSurfaceViewActivity.java
- Layout:
- hello_world.xml
- PolyToPoly
- Demonstrates calling the {@link android.graphics.Matrix.html#setPolyToPoly(float[],int,float[],int,int)} method to translate coordinates on a canvas to a new perspective (used to simulate perspective).
- DrawPoints
- Demonstrates using the {@link android.graphics.Paint} and {@link android.graphics.Canvas} objects to draw random points on the screen, with different colors and strokes.
- PathEffects
- Demonstrates the use of {@link android.graphics.Path} and various {@link android.graphics.PathEffect} subclasses.
- SurfaceView Overlay
- Shows how you can place overlays on top of a SurfaceView.
- Code:
- SurfaceViewOverlay.java
- Layout:
- surface_view_overlay.xml
- TouchPaint
- Demonstrates the handling of touch screen events to implement a simple painting app.
5. media - API Demos
Files 미디어 플레이어
6.os - API Demos
Files 파일
7.text - API Demos
- Linkify 텍스트
- Demonstrates the {@link android.text.util.Linkify Linkify} class, which converts URLs in a block of text into hyperlinks.
Files 파일
8. view - API Demos
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 FILL_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 fill_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.
-
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="3dip"
android:text="@string/baseline_1_label" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="3dip"
android:text="@string/baseline_1_button" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:text="@string/baseline_1_bigger" />
</LinearLayout> |
- 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.
-
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="3dip"
android:text="@string/baseline_4_label" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="3dip"
android:layout_gravity="center_vertical"
android:text="@string/baseline_4_button" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:textSize="20sp"
android:text="@string/baseline_4_bigger" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="3dip"
android:text="@string/baseline_4_label_2" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="3dip"
android:layout_gravity="bottom"
android:text="@string/baseline_4_label_3" />
</LinearLayout> |
- 6. Multi-line
- Demonstrates a baseline alignment with a multiline field.
- 7. Relative
- Demonstrates baseline alignment in a RelativeLayout.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:id="@+id/anchor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:textStyle="bold"
android:text="@string/baseline_7_fat" />
<TextView
android:layout_width="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignBaseline="@id/anchor"
android:layout_height="wrap_content"
android:text="@string/baseline_7_lean" />
</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.
-
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.
Controls
- 1. Theme White
- Demonstrates a variety of common form type widgets, such as check boxes and radio buttons using the white theme.
-
- 2. Theme Dark
- Demonstrates a variety of common form type widgets, such as check boxes and radio buttons using the dark theme.
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.