/*
* Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.view;
import com.android.internal.R;
import com.android.internal.view.menu.MenuBuilder;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Interpolator;
import android.graphics.LinearGradient;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.Point;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.Region;
import android.graphics.Shader;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.util.AttributeSet;
import android.util.Config;
import android.util.EventLog;
import android.util.Log;
import android.util.Pool;
import android.util.Poolable;
import android.util.PoolableManager;
import android.util.Pools;
import android.util.SparseArray;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityEventSource;
import android.view.accessibility.AccessibilityManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputMethodManager;
import android.widget.ScrollBarDrawable;
import java.lang.ref.SoftReference;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.WeakHashMap;
/**
* <p>
* This class represents the basic building block for user interface components. A View
* occupies a rectangular area on the screen and is responsible for drawing and
* event handling. View is the base class for <em>widgets</em>, which are
* used to create interactive UI components (buttons, text fields, etc.). The
* {@link android.view.ViewGroup} subclass is the base class for <em>layouts</em>, which
* are invisible containers that hold other Views (or other ViewGroups) and define
* their layout properties.
* </p>
*
* <div class="special">
* <p>For an introduction to using this class to develop your
* application's user interface, read the Developer Guide documentation on
* <strong><a href="{@docRoot}guide/topics/ui/index.html">User Interface</a></strong>. Special topics
* include:
* <br/><a href="{@docRoot}guide/topics/ui/declaring-layout.html">Declaring Layout</a>
* <br/><a href="{@docRoot}guide/topics/ui/menus.html">Creating Menus</a>
* <br/><a href="{@docRoot}guide/topics/ui/layout-objects.html">Common Layout Objects</a>
* <br/><a href="{@docRoot}guide/topics/ui/binding.html">Binding to Data with AdapterView</a>
* <br/><a href="{@docRoot}guide/topics/ui/ui-events.html">Handling UI Events</a>
* <br/><a href="{@docRoot}guide/topics/ui/themes.html">Applying Styles and Themes</a>
* <br/><a href="{@docRoot}guide/topics/ui/custom-components.html">Building Custom Components</a>
* <br/><a href="{@docRoot}guide/topics/ui/how-android-draws.html">How Android Draws Views</a>.
* </p>
* </div>
*
* <a name="Using"></a>
* <h3>Using Views</h3>
* <p>
* All of the views in a window are arranged in a single tree. You can add views
* either from code or by specifying a tree of views in one or more XML layout
* files. There are many specialized subclasses of views that act as controls or
* are capable of displaying text, images, or other content.
* </p>
* <p>
* Once you have created a tree of views, there are typically a few types of
* common operations you may wish to perform:
* <ul>
* <li><strong>Set properties:</strong> for example setting the text of a
* {@link android.widget.TextView}. The available properties and the methods
* that set them will vary among the different subclasses of views. Note that
* properties that are known at build time can be set in the XML layout
* files.</li>
* <li><strong>Set focus:</strong> The framework will handled moving focus in
* response to user input. To force focus to a specific view, call
* {@link #requestFocus}.</li>
* <li><strong>Set up listeners:</strong> Views allow clients to set listeners
* that will be notified when something interesting happens to the view. For
* example, all views will let you set a listener to be notified when the view
* gains or loses focus. You can register such a listener using
* {@link #setOnFocusChangeListener}. Other view subclasses offer more
* specialized listeners. For example, a Button exposes a listener to notify
* clients when the button is clicked.</li>
* <li><strong>Set visibility:</strong> You can hide or show views using
* {@link #setVisibility}.</li>
* </ul>
* </p>
* <p><em>
* Note: The Android framework is responsible for measuring, laying out and
* drawing views. You should not call methods that perform these actions on
* views yourself unless you are actually implementing a
* {@link android.view.ViewGroup}.
* </em></p>
*
* <a name="Lifecycle"></a>
* <h3>Implementing a Custom View</h3>
*
* <p>
* To implement a custom view, you will usually begin by providing overrides for
* some of the standard methods that the framework calls on all views. You do
* not need to override all of these methods. In fact, you can start by just
* overriding {@link #onDraw(android.graphics.Canvas)}.
* <table border="2" width="85%" align="center" cellpadding="5">
* <thead>
* <tr><th>Category</th> <th>Methods</th> <th>Description</th></tr>
* </thead>
*
* <tbody>
* <tr>
* <td rowspan="2">Creation</td>
* <td>Constructors</td>
* <td>There is a form of the constructor that are called when the view
* is created from code and a form that is called when the view is
* inflated from a layout file. The second form should parse and apply
* any attributes defined in the layout file.
* </td>
* </tr>
* <tr>
* <td><code>{@link #onFinishInflate()}</code></td>
* <td>Called after a view and all of its children has been inflated
* from XML.</td>
* </tr>
*
* <tr>
* <td rowspan="3">Layout</td>
* <td><code>{@link #onMeasure}</code></td>
* <td>Called to determine the size requirements for this view and all
* of its children.
* </td>
* </tr>
* <tr>
* <td><code>{@link #onLayout}</code></td>
* <td>Called when this view should assign a size and position to all
* of its children.
* </td>
* </tr>
* <tr>
* <td><code>{@link #onSizeChanged}</code></td>
* <td>Called when the size of this view has changed.
* </td>
* </tr>
*
* <tr>
* <td>Drawing</td>
* <td><code>{@link #onDraw}</code></td>
* <td>Called when the view should render its content.
* </td>
* </tr>
*
* <tr>
* <td rowspan="4">Event processi
Android 2.0是Google发布的一个重要的Android操作系统版本,它带来了许多新特性和性能改进,对开发者来说,深入理解其源码是提升开发技能、优化应用性能的关键。在这个压缩包中,你将找到的是Android 2.0版本的Java源码,这对于Android开发者来说是一份极其宝贵的资源。 一、Android系统架构 Android系统由多个层次组成,从低到高依次为Linux内核层、硬件抽象层(HAL)、系统库层、应用程序框架层以及应用程序层。在Android 2.0中,这些层的源码都会有所体现,包括系统服务、库函数、API接口等。 1. Linux内核:作为Android的基础,内核负责硬件管理和系统调用,Android 2.0可能包含了针对当时设备特性的定制优化。 2. HAL(硬件抽象层):这部分代码将硬件设备的操作封装成统一的接口,供上层使用,降低了与硬件交互的复杂性。 3. 系统库:Android 2.0包含了许多系统库,如SQLite用于数据库管理,OpenSSL用于网络加密,还有一些图形处理和多媒体相关的库。 4. 应用程序框架:这是开发者最常接触的部分,包括Activity Manager、Content Provider、Broadcast Receiver、Service等关键组件的实现。在Android 2.0中,这些框架可能进行了优化,提升了性能和用户体验。 5. 应用程序:虽然这里主要提供的是系统层面的源码,但开发者也可以从中学习如何编写遵循Android 2.0规范的应用程序。 二、Android 2.0的新特性 1. 多账户支持:在Android 2.0中,用户可以添加多个Google账户,便于在不同账户间切换,这对商务用户尤其有用。 2. 更快的虚拟机:Dalvik VM在Android 2.0中进行了优化,提升了运行速度,使得应用程序运行更加流畅。 3. 改进的浏览器:Android 2.0的内置浏览器升级,支持多标签浏览,提高了网页渲染性能和稳定性。 4. 自动拼写检查和词组输入:在键盘输入方面,Android 2.0引入了自动拼写检查和词组输入功能,提升了输入体验。 5. 无线打印:首次在Android系统中引入了无线打印功能,用户可以直接从设备打印文档或图片。 6. 更好的联系人管理:联系人应用进行了重构,支持合并重复联系人,增强了联系人搜索功能。 三、学习与分析 通过阅读和分析Android 2.0的源码,开发者可以深入理解系统的工作原理,发现性能瓶颈,改进应用程序设计,甚至为新的Android版本贡献代码。例如,你可以研究如何优化服务的启动和停止,如何提高UI的响应速度,或者如何利用硬件特性来提升应用性能。 总结,这个Android 2.0 Java源码压缩包提供了丰富的学习材料,无论你是初学者还是资深开发者,都能从中受益匪浅。通过对源码的深入学习,你不仅可以掌握Android开发的核心技术,还能了解软件工程的最佳实践,提升自己的编程技能。
















































































































- 1
- 2
- 3
- 4
- 5
- 6
- 20

- 粉丝: 7
- 资源: 24
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- 基于Python的活动管理系统基础教程
- 基于JavaScript和Java的电影院寒假作业设计源码
- 光伏储能系统Simulink仿真:光照变化下的电源管理与负载适应及蓄电池双闭环控制策略模型说明,光伏储能系统Simulink仿真:光照变化下的电源管理与负载调节策略研究,光伏储能离网系统simulin
- 基于Vue.js的仿豆瓣电影网站设计源码
- 基于C++和C语言的电子相册设计源码
- 西门子PLC与组态王协同设计水泥混凝土自动配料系统:实时视频组态界面与脚本应用,西门子PLC与组态王联动设计水泥混凝土自动配料系统:组态界面实战展示及脚本解析,西门子PLC和组态王组态自动配料系统的设
- 基于Vue框架的yimi CRM电子邮件营销系统设计源码
- 基于聚类分析与MPC路径跟踪控制的车辆横向稳定性判别及仿真研究资料汇编,基于聚类分析的车辆横向稳定性判别与MPC路径跟踪控制技术的研究资料,基于聚类的车辆横向稳定性判别,MPC路径跟踪控制 传统相平
- (源码)基于TensorFlow的语义分割模型.zip
- 基于深度度量学习的医学图像文本匹配Nwpu 2025毕业设计源码
- 基于Python语言的大二课程练习与作业设计源码
- Q-learning算法在机器人路径规划与避障中的实践教程:模块化编程与新手入门指南,基于Q-learning算法的机器人路径规划与避障详解:模块化编程教程,适合初学者快速入门,Q-learning机
- 基于微信小程序的看病陪诊住院陪护服务设计源码
- 基于Java编程语言的在线教学质量评价与信息改进系统设计源码
- 锂电池SOC研究及电池模型辨识:仅供参考学习的详细资料,深入解析锂电池SOC计算及电池模型辨识,仅供参考学习之用,锂电池SOC(包括其他详细见图3),电池模型辨识,仅供参考学习 ,锂电池SOC; 电池
- 基于SpringBoot+Vue框架的智能停车计费系统设计源码



- 1
- 2
前往页