Android 开发文档 程序基础 ——activity组件
2010-06-19 10:43
519 查看
所谓的activity组件就是用来提供可视化界面的。
一个程序中可以有很多activity组件组成一个粘性的用户界面,但是又彼此独立。每个activity都是Activity基类的子类。
每个activity都有一个默认的window,一般来说,这个window都是充满屏幕,当然也可以小于屏幕并浮动在其他窗口上面。
activity可以使用特定的窗口,比如弹出窗口。
窗口中的可视内容是views(View类衍生的对象)的一个层次。每个views都控制窗口中的一个矩形区域。父级的views包含子级的
views并组织其布局。末端的views相应用户在其区域的操作。也就是说view是activity与用户发生交互的地方。
views是由Activity.setContentView()
方法放置在
activity window中。
转自我的android博客
原文
Activities
An activity
presents a visual
user interface for one focused endeavor the user can undertake. For
example, an activity might present a list of menu items users can
choose from or it might display photographs along with their captions. A
text messaging application might have one activity that shows a list
of contacts to send messages to, a second activity to write the message
to the chosen contact, and other activities to review old messages or
change settings. Though they work together to form a cohesive user
interface, each activity is independent of the others. Each one is
implemented as a subclass of the Activity
base class.
An application might consist of just one activity or, like the text
messaging application just mentioned, it may contain several. What the
activities are, and how many there are depends, of course, on the
application and its design. Typically, one of the activities is marked
as the first one that should be presented to the user when the
application is launched. Moving from one activity to another is
accomplished by having the current activity start the next one.
Each activity is given a default window to draw in. Typically, the
window fills the screen, but it might be smaller than the screen and
float on top of other windows. An activity can also make use of
additional windows — for example, a pop-up dialog that calls for a user
response in the midst of the activity, or a window that presents users
with vital information when they select a particular item on-screen.
The visual content of the window is provided by a hierarchy of views —
objects derived from the base View
class. Each view controls a particular rectangular space within the
window. Parent views contain and organize the layout of their children.
Leaf views (those at the bottom of the hierarchy) draw in the
rectangles they control and respond to user actions directed at that
space. Thus, views are where the activity’s interaction with the user
takes place. For example, a view might display a small image and
initiate an action when the user taps that image. Android has a number
of ready-made views that you can use — including buttons, text fields,
scroll bars, menu items, check boxes, and more.
A view hierarchy is placed within an activity’s window by the Activity.setContentView()
method. The content view
is the View object at the root of the
hierarchy. (See the separate User Interface document for more
information on views and the hierarchy.)
一个程序中可以有很多activity组件组成一个粘性的用户界面,但是又彼此独立。每个activity都是Activity基类的子类。
每个activity都有一个默认的window,一般来说,这个window都是充满屏幕,当然也可以小于屏幕并浮动在其他窗口上面。
activity可以使用特定的窗口,比如弹出窗口。
窗口中的可视内容是views(View类衍生的对象)的一个层次。每个views都控制窗口中的一个矩形区域。父级的views包含子级的
views并组织其布局。末端的views相应用户在其区域的操作。也就是说view是activity与用户发生交互的地方。
views是由Activity.setContentView()
方法放置在
activity window中。
转自我的android博客
原文
Activities
An activity
presents a visual
user interface for one focused endeavor the user can undertake. For
example, an activity might present a list of menu items users can
choose from or it might display photographs along with their captions. A
text messaging application might have one activity that shows a list
of contacts to send messages to, a second activity to write the message
to the chosen contact, and other activities to review old messages or
change settings. Though they work together to form a cohesive user
interface, each activity is independent of the others. Each one is
implemented as a subclass of the Activity
base class.
An application might consist of just one activity or, like the text
messaging application just mentioned, it may contain several. What the
activities are, and how many there are depends, of course, on the
application and its design. Typically, one of the activities is marked
as the first one that should be presented to the user when the
application is launched. Moving from one activity to another is
accomplished by having the current activity start the next one.
Each activity is given a default window to draw in. Typically, the
window fills the screen, but it might be smaller than the screen and
float on top of other windows. An activity can also make use of
additional windows — for example, a pop-up dialog that calls for a user
response in the midst of the activity, or a window that presents users
with vital information when they select a particular item on-screen.
The visual content of the window is provided by a hierarchy of views —
objects derived from the base View
class. Each view controls a particular rectangular space within the
window. Parent views contain and organize the layout of their children.
Leaf views (those at the bottom of the hierarchy) draw in the
rectangles they control and respond to user actions directed at that
space. Thus, views are where the activity’s interaction with the user
takes place. For example, a view might display a small image and
initiate an action when the user taps that image. Android has a number
of ready-made views that you can use — including buttons, text fields,
scroll bars, menu items, check boxes, and more.
A view hierarchy is placed within an activity’s window by the Activity.setContentView()
method. The content view
is the View object at the root of the
hierarchy. (See the separate User Interface document for more
information on views and the hierarchy.)
相关文章推荐
- Android 开发文档 程序基础 ——Services组件
- Android 开发文档 程序基础 ——Content providers组件
- Android 开发基础系列——程序崩溃之Unable to instantiate activity ComponentInfo
- Android 开发文档 程序基础——Intent filters
- Android 开发文档 之程序基础Application Fundamentals
- Android 开发文档 程序基础——Activities and Tasks
- android activity开发文档翻译 - 1 - 基础篇
- Android 开发文档 程序基础 ——Broadcast receivers组件
- Android 开发文档 程序基础——Affinities and new tasks
- Android 开发文档 程序基础——Activating components: intents
- Android 开发文档 程序基础——Shutting down components
- Android 开发文档 程序基础——The manifest file
- Android官方开发文档Training系列课程中文版:与其它APP交互之从Activity获得结果
- Android四大组件(Activity详解)----如何定义程序主入口
- Android程序开发基础之——页面传值
- Android组件activity_基础(三)
- Android基础总结.doc(第六节、 Activity组件的启动模式、广播、服务组件 )
- Android开发之道(4)程序框架基础
- Android开发之道(4)程序框架基础
- 27、Android开发基础之Activity的横竖屏生命周期补充