android

1. Generally, a mobile is first and foremost a phone, secondly an SMS and e-mail communicator, thirdly a camera, and fourthly an MP3 player. The applications you write will most likely be in a fi fth category of “useful mobile tools.”


2.To assign a user interface to an Activity, call setContentView from the onCreate method of your
Activity.


3.  An Activity without a corresponding activity tag can’t be started.

 

4. Android applications do not control their own process lifetimes; the Android run
time manages the process of each application

 

5. Activity Stacks

   The state of each Activity is determined by its position on the Activity stack, a last-in–fi rst-out collection of all the currently running Activities. When a new Activity starts, the current foreground screen is moved to the top of the stack. If the user navigates back using the Back button, or the foreground Activity is closed, the next Activity on the stack moves up and becomes active.


Activity States

Active When an Activity is at the top of the stack, it is the visible, focused, foreground activity
that is receiving user input. Android will attempt to keep it alive at all costs, killing Activities
further down the stack as needed, to ensure that it has the resources it needs. When another
Activity becomes active, this one will be paused.
Paused In some cases, your Activity will be visible but will not have focus; at this point, it’s
paused. This state is reached if a transparent or non-full-screen Activity is active in front of it.
When paused, an Activity is treated as if it were active; however, it doesn’t receive user input
events. In extreme cases, Android will kill a paused Activity to recover resources for the active
Activity. When an Activity becomes totally obscured, it becomes stopped.
Stopped When an Activity isn’t visible, it “stops.” The Activity will remain in memory retaining
all state and member information; however, it is now a prime candidate for execution when
the system requires memory elsewhere. When an Activity is stopped, it’s important to save data
and the current UI state. Once an Activity has exited or closed, it becomes inactive.
Inactive After an Activity has been killed, and before it’s been launched, it’s inactive. Inactive
Activities have been removed from the Activity stack and need to be restarted before they can
be displayed and used.

 

6. it’s important to save all UI state changes and persist all data when an Activity is paused or
stopped. Once an Activity does become active, it should restore those saved values.

 

7.The following list highlights some of the more familiar toolbox controls:
❑ TextView A standard read only text label. It supports multiline display, string formatting,
and automatic word wrapping.
❑ EditText An editable text entry box. It accepts multiline entry and word wrapping.
❑ ListView A View Group that creates and manages a group of Views used to display the items
in a List. The standard ListView displays the string value of an array of objects using a Text
View for each item.
❑ Spinner Composite control that displays a TextView and an associated ListView that lets you
select an item from a list to display in the textbox. It’s made from a Text View displaying the
current selection, combined with a button that displays a selection dialog when pressed.
❑ Button Standard push-button
❑ CheckBox Two-state button represented with a checked or unchecked box
❑ RadioButton Two-state grouped buttons. Presents the user with a number of binary options
of which only one can be selected at a time.

 

8. The following list includes some of the more versatile layout classes available:
❑ FrameLayout The simplest of the Layout Managers, the Frame Layout simply pins each child
view to the top left corner. Adding multiple children stacks each new child on top of the previous,
with each new View obscuring the last.
❑ LinearLayout A Linear Layout adds each child View in a straight line, either vertically or horizontally.
A vertical layout has one child View per row, while a horizontal layout has a single row
of Views. The Linear Layout Manager allows you to specify a “weight” for each child View that
controls the relative size of each within the available space.
❑ RelativeLayout Using the Relative Layout, you can defi ne the positions of each of the child
Views relative to each other and the screen boundaries.
❑ TableLayout The Table Layout lets you lay out Views using a grid of rows and columns. Tables
can span multiple rows and columns, and columns can be set to shrink or grow.
❑ AbsoluteLayout In an Absolute Layout, each child View’s position is defi ned in absolute coordinates. Using this class, you can guarantee the exact layout of your components, but at a price.
Compared to the previous managers, describing a layout in absolute terms means that your layout
can’t dynamically adjust for different screen resolutions and orientations.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值