该系列是从个人的笔记中整理出来,大多内容是各处摘抄来的还有少部分个人理解。但以前记笔记没想过写博客,也就没记出处,所以有冒犯原作者和各位园友之处,还请见谅,同时所写文档也会标明为转载。
摘要:转自http://developer.android.com/guide/topics/ui/declaring-layout.htmlLayoutsA layout defines the visual structure for a user interface, such as the UI for an activity or app widget. You can declare a layout in two ways:Declare UI elements in XML. Android provides a straight forward XMLvocabulary that
阅读全文
摘要:CSS中padding和margin的区别: margin:外边距; border:边框 padding:内边距下图是CSS盒模型:Android中的padding和margin与CSS中类似: padding是站在父view的角度描述问题,它规定它里面的内容必须与这个父view边界的距离。margin则是站在自己的角度描述问题,规定自己和其他(上下左右)的view之间的距离,如果同一级只有一个view,那么它的效果基本上就和padding一样了。Margin和Padding属性中四个值的先后顺序及区别,Margin和Padding属性中四个值的顺序为:上右下左,按照顺时针方向罗列的。...
阅读全文
摘要:PendingIntent可以看作是对Intent的包装。供当前App之外的其他App调用。有点“被动”或是“Callback”的意思,但不是严格意义上的“被动”或是“Callback”。总之,当前App不能用它马上启动它所包裹的Intent。而是在外部App执行这个PendingIntent时,间接地、实际地调用里面的Intent。PendingIntent主要持有的信息是它所包装的Intent和当前App的Context。正由于PendingIntent中保存有当前App的Context,使它赋予外部App一种能力,使得外部App可以如同当前App一样的执行PendingIntent里的I
阅读全文
摘要:转自http://developer.android.com/guide/topics/ui/notifiers/notifications.htmlNotificationA notification is a message you can display to the user outside of your application'snormal UI. When you tell the system to issue a notification, it first appears as an icon in thenotification area. To see the
阅读全文
摘要:转自http://developer.android.com/guide/topics/ui/notifiers/toasts.htmlToastsA toast provides simple feedback about an operation in a small popup. It only fills the amount of space required for the message and the current activity remains visible and interactive. For example, navigating away from an em
阅读全文
摘要:转自http://developer.android.com/guide/topics/ui/controls/spinner.htmlSpinnersSpinners provide a quick way to select one value from a set. In the default state, a spinner shows its currently selected value. Touching the spinner displays a dropdown menu with all other available values, from which the u
阅读全文
摘要:转自http://developer.android.com/guide/components/intents-filters.htmlIntents and Intent FiltersThree of the core components of an application — activities, services, and broadcast receivers — are activated through messages, called intents. Intent messaging is a facility for late run-time binding betw
阅读全文
摘要:转自http://developer.android.com/guide/topics/ui/controls/button.htmlA button consists of text or an icon (or both text and an icon) that communicates what action occurs when the user touches it.Depending on whether you want a button with text, an icon, or both, you can create the button in your layou
阅读全文
摘要:转自http://developer.android.com/guide/components/services.html自己胡乱翻译了一部分有时间再补上吧,不当之处,请指正。A Service is an application component that can perform long-running operations in the background and does not provide a user interface. Another application component can start a service and it will continue to ru
阅读全文
摘要:摘自http://developer.android.com/guide/components/processes-and-threads.html,自己草草翻译下,不当之处,请指正。Threads When an application is launched, the system creates a thread of execution for the application, called "main." This thread is very important because it is in charge of dispatching events to t
阅读全文
摘要:先引用一段关于进程与线程之间关系的描述<——多线程编程的基础知识点 在进程中,有些程序流程块是可以乱序执行的,并且这个代码块可以同时被多次执行。实际上,这样的代码块就是线程体。线程是进程中乱序执行的代码流程。当多个线程同时运行的时候,这样的执行模式成为并发执行。” 下面我以一个日常生活中简单的例子来说明进程和线程之间的区别和联系: 这副图是一个双向多车道的道路图,假如我们把整条道路看成是一个“进程”的话,那么图中由白色虚线分隔开来的各个车道就是进程中的各个“线程”了。 ①这些线程(车道)共享了进程(道路)的公共资源(土地资源)。 ②这些线程(车道)必须依赖于进程(道路),也就是说,线程不
阅读全文
摘要:摘自http://www.dewen.org/q/7471,来自官方的API文档 Called to retrieve per-instance state from an activity before being killed so that the state can be restored in onCreate(Bundle) or onRestoreInstanceState(Bundle) (the Bundle populated by this method will be passed to both).This method is called before an act
阅读全文
摘要:Activity生命周期首先看一下Android API中所提供的Activity生命周期图,直角矩形代表了callback方法,你可以实现这些方法从而使Activity在改变状态的时候执行你制定的操作,带颜色的椭圆形是Activity的主要状态。java.lang.Object android.content.Context android.app.ApplicationContext android.app.Activity Activity 是用户唯一可以看得到的东西。几乎所有的activity都与用户进行交互,所以Activity主要负责的就是创建显示窗口,你可以在这些窗口里使用set
阅读全文