Android—API中文文档
- 格式:doc
- 大小:1004.00 KB
- 文档页数:41
Android中⽂API(70)——BluetoothDevice[蓝⽛]前⾔声明 欢迎转载,但请保留⽂章原始出处:)正⽂ ⼀、结构public static class BluetoothDevice extends Object implements Parcelableng.Objectandroid.bluetooth.BluetoothDevice ⼆、概述 代表⼀个远程蓝⽛设备。
让你创建⼀个带有各⾃设备的BluetoothDevice或者查询其皆如名称、地址、类和连接状态等信息。
对于蓝⽛硬件地址⽽⾔,这个类仅仅是⼀个瘦包装器。
这个类的对象是不可改变的。
这个类上的操作会使⽤这个⽤来创建BluetoothDevice类的BluetoothAdapter类执⾏在远程蓝⽛硬件上。
为了获得BluetoothDevice,类,使⽤BluetoothAdapter.getRemoteDevice(String)⽅法去创建⼀个表⽰已知MAC地址的设备(⽤户可以通过带有BluetoothAdapter类来完成对设备的查找)或者从⼀个通过 BluetoothAdapter.getBondedDevices()得到返回值的有联系的设备集合来得到该设备。
注意:需要权限 参见 三、常量String ACTION_ACL_CONNECTED⼴播活动:指明⼀个与远程设备建⽴的低级别(ACL)连接。
总是包含附加域ACL连接通过Android蓝⽛栈⾃动进⾏管理需要权限接收常量值: "android.bluetooth.device.action.ACL_CONNECTED"String ACTION_ACL_DISCONNECTED⼴播活动:指明⼀个来⾃于远程设备的低级别(ACL)连接的断开总是包含附加域ACL连接通过Android蓝⽛栈⾃动进⾏管理需要权限接收常量值: "android.bluetooth.device.action.ACL_DISCONNECTED"String ACTION_ACL_DISCONNECT_REQUESTED⼴播活动:指明⼀个为远程设备提出的低级别(ACL)的断开连接请求,并即将断开连接。
本android帮助文档为在学习视频时自己制作比较混乱和粗糙,使用时查找第一页导航,再用word的查找功能进行查找导航页——基础说明——监听器的设置->创建监听器——调用android自带的短信发送功能——Activity的方法和生命周期(创建对话框风格的)——Activity的布局方法--LinearLayout线性--常用标签--TableLayout表格--GridView滑动表格--RelativeLayout相对布局——常用控件--除去title和全屏显示--EditText可输入文本框--RadioGroup和RadioButton单选按钮--Toast提示框--CheckBox多选按钮--ProgressBar进度条--ListView可选列表--MENU菜单控件的使用--Animation动画效果--4种动画效果--动画实现--JAVA中的实现--XMl文件中的实现-- Gallery (走马灯式的)移动选择控件--ImageSwitcher图片显示控件--ImageButton图片按钮控件--AlertDialog提示框——Handler的使用---线程--handler的简单应用--用handler更新ProgressBar进度条--handler与线程--线程之间的数据传递--Bundle对象(大量复杂数据) --Message对象(少量简单)--建立一个新的线程--HandlerThread类——SQLite的使用--SQLiteOpenHelper的方法注:带有下划线的是一些封装--代码的编写的可以直接调用的类,在”帮助文档的链接文件\封装的类”文件--封装的DatabaseHelper类夹中都有保存可以直接导入调用--主java文件--命令行的查询方法——文件下载--文件下载--步骤--在注册文件中注册权限--封装的HttpDownLoad类--在Activity中的调用--访问SDCARD --注册权限--封装的FileUtils类--在Activity文件中的调用——_XML文件的解析--SAX常用接口--XMl文件解析实例--实现ContentHandler接口的类--在Activity中的调用 XMl文件实例aaa.xml——广播机制--android中的广播机制--编写BroadcastReveicer类--创建包含BroadcastReveicer类的java文件--在onReceive中处理收到短消息的事件--AndroidManifest.XML注册文件中注册--代码当中进行注册--Activity中发送广播——WIFI--WIFI网卡的状态--操作WIFI网卡所需要的部分权限--改变WIFI网卡的状态——Socket编程--使用基于TCP协议的Socket--使用基于UDP协议的Socket——ServiceAndroid创建基础:src文件中为包类,其中用于建立activity的java文件res中drawable中为图片和标签layout中为布局文件,用于每个activity.java文件的标签布局AndroidManifest中为注册文件,每一个activity的建立都需要在其中注册代码的编写intent对象(用于在不同activity转换时的监听器设置)ponent name 指定activity2.Action 指定activity的作用3.Data 传送的数据类型4.Extras (额外)传送的键值对创建监听器的关键代码:(在第一个activity中)//创建一个Button监听器class myButtonListener implements OnClickListener{public void onClick(View v) {// TODO Auto-generated method stub//创建一个intent类Intent intent = new Intent();//创建一个键值对intent.putExtra("nexttext", "跳转成功");//创建关联intent.setClass(FirstActivity.this, SecondActivity.class);FirstActivity.this.startActivity(intent);}}在第一个activity中的转换关键标签上绑定监听器:(例在Button标签)(在onCreate中)//在Button上绑定监听器myButton.setOnClickListener(new myButtonListener());在第二个activity中的应用键值对(数据传递):(在onCreate中)//获取键值对Intent intent = getIntent();//获得键值对的值String text = intent.getStringExtra("nexttext");在Activity中调用android自带的短信发送功能的关键代码://调用短信发送功能class myButtonListener implements OnClickListener{public void onClick(View v) {// TODO Auto-generated method stub//发送号码Uri uri = Uri.parse("smsto://0800000123");Intent it = new Intent(Intent.ACTION_SENDTO,uri);//发送内容it.putExtra("sms_body", "the SMS text");startActivity(it);}}Activity的方法和生命周期:--onCreate 一个activity启动时运行(第一次)--onStart 当activity处于可见状态时运行--onResume 当activity可以得到用户焦点时(可以被操作)运行--onPause 当activity处于暂停状态时(例如弹出其他activity而原activity未被完全覆盖),可在此保存数据,以便此activity释放时恢复原状--onStop 当activity完全不可见时--onRestart 当activity未被销毁而在此被调用时--onDestory 当activity被销毁时当调用finish();语句时,Activity被销毁。
Android 3.1 r1 API中文文档(6)——ImageView前言本章内容是android.widget.ImageView,为早前发布版本的完整版,版本为Android 3.1 r1,翻译来自"cnmahj"和"农民伯伯",欢迎大家访问"cnmahj"的博客:,再次感谢"/cnmahj"!欢迎你一起参与Android的中文翻译,联系我over140@。
声明欢迎转载,但请保留文章原始出处:)博客园:/Android中文翻译组:http://goo.gl/6vJQlImageView译者署名:cnmahj、农民伯伯译者博客:/cnmahj版本:Android 3.1 r1结构继承关系public class View.OnClickListner extends Viewng.Objectandroid.view.Viewandroid.widget.ImageView直接子类ImageButton, QuickContactBadge间接子类ZoomButton类概述显示任意图像,例如图标。
ImageView类可以加载各种来源的图片(如资源或图片库),需要计算图像的尺寸,比便它可以在其他布局中使用,并提供例如缩放和着色(渲染)各种显示选项。
嵌套类enum ImageView.ScaleType将图片边界缩放,以适应视图边界时的可选项XML属性公共方法public final void clearColorFilter ()(译者注:清除颜色过滤,参见这里)public int getBaseline ()返回部件顶端到文本基线的偏移量。
如果小部件不支持基线对齐,该方法返回-1。
返回值小部件顶端到文本基线的偏移量;或者是-1 当小部件不支持基线对齐时。
public boolean getBaselineAlignBottom ()返回当前视图基线是否将考虑视图的底部。
Android中文文档:开发和调试在eclipse上开发Android应用程序在用eclipse IDE开发android应用程序之前,你首先要创建一个Android工程,并且建立一个启动配置,在此之后你才可以开始编写,运行,以及调试你的应用程序。
以下章节是假设你已经在eclipse环境中安装了ADT插件,如果你没有安装,请安装之后再使用以下说明。
参考安装eclipse 插件(ADT)创建一个android工程ADT提供了一个新的工程向导,你可以快速的创建一个新的工程或者在现有代码上创建工程。
创建工程的步骤如下:选择File > New > Project选择 Android > Android Project, 然后按下 Next选择项目内容:选择 Create new project in workspace,为编码创建一个全新的工程。
输入工程名称(project name),基础软件包的名称(the base package name),以及Activity 类的名称。
以创建stub .java文件等文件和程序名字。
选择Create project from existing source ,为已有代码创建一个工程。
如果你想编译运行SDK中提供的示例程序,可以使用这个选项。
示例程序的存放在SDK的samples/目录下。
浏览包含已有代码的目录,点击ok,如果目录中包含有可用的android manifest 文件,ADT 将为你填写合适的软件包,activity,和应用程序名称。
按下Finish.ADT插件会根据你的工程类型创建合适的文件和文件夹,如下:src/ 包含stub .java Activity文件的文件夹.res/ 资源文件夹.AndroidManifest.xml 工程清单.创建一个启动项能够在eclipse上运行调试应用程序之前,你必须为它创建一个启动项。
手机信息查看助手项目用户使用说明✧项目名称:手机信息查看助手✧团队成员:刘建良、孙希鹏、王彬、卞绪杰、王嘉禄、张斌✧指导教师:冯君目录第一章引言 (1)1.1 编写目的 (1)1.2 背景 (1)1.3 定义 (1)1.4 参考资料 (2)第二章项目介绍以及开发计划 (3)2.1 目标 (3)2.2 功能 (3)2.3 准备工作 (3)2.4 任务分配 (3)第三章软件环境与平台 (5)3.1 开发环境 (5)3.2 开发平台 (5)3.3 运行环境 (5)第四章使用说明 (6)4.1 软件的安装 (6)4.2 软件的使用 (6)4.2.1 初始界面 (6)4.2.2程序主界面 (6)第一章引言1.1 编写目的编写本文档的主要目的在于介绍开发“手机信息查看助手”项目的过程中的时间安排、任务分配、开发规划的过程、软件的总体开发以及模块的详细开发。
同时还有软件开发过程、测试过程的总结。
以及软件在运行的过程中的环境需求以及用户说明。
本文档用于本小组成员和指导老师阅读。
1.2 背景1)开发系统的名称:手机信息查看助手2)项目提出者:本组成员3)项目开发者:本组成员1.3 定义1)Android技术Android 是Google开发的基于Linux平台的开源手机操作系统。
它包括操作系统、用户界面和应用程序——移动电话工作所需的全部软件,而且不存在任何以往阻碍移动产业创新的专有权障碍。
Google与开放手机联盟合作开发了Android,这个联盟由包括中国移动、摩托罗拉、高通、宏达电和 T-Mobile 在内的30多家技术和无线应用的领军企业组成。
Google通过与运营商、设备制造商、开发商和其他有关各方结成深层次的合作伙伴关系,希望借助建立标准化、开放式的移动电话软件平台,在移动产业内形成一个开放式的生态系统。
2)Web ServiceWeb Service是部署在Web上的对象、组件,通过Internet上的标准协议XML 及HTTP,实现异构平台间的信息集成与互操作。
一、Introduction(入门)0、Introduction to Android(引进到Android)Android provides a rich application framework that allows you to build innovative apps and games for mobile devices in a Java language environment. The documents listed in the left navigation provide details about how to build apps using Android's various APIs.To learn how apps work, startwith App Fundamentals.To begin coding right away, read Building Your First AppAndroid提供了丰富的应用程序框架,它允许您在Java语言环境中构建移动设备的创新应用程序和游戏。
在左侧导航中列出的文档提供了有关如何使用Android的各种API来构建应用程序的详细信息。
要了解如何开发应用,从应用基础开始。
如何开始一个正确的编码,请参照建立你的第一个应用程序。
Apps provide multiple entry points 应用程序提供多个入口点Apps adapt to different devices 应用程序适应不同的设备Android apps are built as a combination of distinct components that can be invoked individually. For instance, an individual activity provides a single screen for a user interface, and a service independently performs work in the background.Android应用程序被构建为能够单独地被调用不同的部件的组合。
1) What is Android?It is an open-sourced operating system that is used primarily on mobile devices, such as cell phones and tablets. It is a Linux kernel-based system that’s been equipped with rich components that allows developers to create and run apps that can perform both basic and advanced functions.2) What Is the Google Android SDK?The Google Android SDK is a toolset that developers need in order to write apps on Android enabled devices. It contains a graphical interface that emulates an Android driven handheld environment, allowing them to test and debug their codes.3) What is the Android Architecture?Android Architecture is made up of 4 key components:- Linux Kernel- Libraries- Android Framework- Android Applications4) Describe the Android Framework.The Android Framework is an important aspect of the Android Architecture. Here you can find all the classes and methods that developers would need in order to write applications on the Android environment.5) What is AAPT?AAPT is short for Android Asset Packaging Tool. This tool provides developers with the ability to deal with zip-compatible archives, which includes creating, extracting as well as viewing its contents.6) What is the importance of having an emulator within the Android environment?The emulator lets developers “play” around an interface that acts as if it were an actual mobile device. They can write and test codes, and even debug. Emulators are a safe place for testing codes especially if it is in the early design phase.7) What is the use of an activityCreator?An activityCreator is the first step towards the creation of a new Android project. It is made up of a shell script that will be used to create new file system structure necessary for writing codes within the Android IDE.8 ) Describe Activities.Activities are what you refer to as the window to a user interface. Just as you create windows in order to display output or to ask for an input in the form of dialog boxes, activities play the same role, though it may not always be in the form of a user interface.9) What are Intents?Intents displays notification messages to the user from within the Android enabled device. It can be used to alert the user of a particular state that occurred. Users can be made to respond to intents.10) Differentiate Activities from Services.Activities can be closed, or terminated anytime the user wishes. On the other hand, services are designed to run behind the scenes, and can act independently. Most services run continuously, regardless of whether there are certain or no activities being executed.11) What items are important in every Android project?These are the essential items that are present each time an Android project is created:- AndroidManifest.xml- build.xml- bin/- src/- res/- assets/12) What is the importance of XML-based layouts?The use of XML-based layouts provides a consistent and somewhat standard means of setting GUI definition format. In common practice, layout details are placed in XML files while other items are placed in source files.13) What are containers?Containers, as the name itself implies, holds objects and widgets together, depending on which specific items are needed and in what particular arrangement that is wanted. Containers may hold labels, fields, buttons, or even child containers, as examples.14) What is Orientation?Orientation, which can be set using setOrientation(), dictates if the LinearLayout is represented asa row or as a column. Values are set as either HORIZONTAL or VERTICAL.15) What is the importance of Android in the mobile market?Developers can write and register apps that will specifically run under the Android environment. This means that every mobile device that is Android enabled will be able to support and run these apps. With the growing popularity of Android mobile devices, developers can take advantage of this trend by creating and uploading their apps on the Android Market for distribution to anyone who wants to download it.16) What do you think are some disadvantages of Android?Given that Android is an open-source platform, and the fact that different Android operating systems have been released on different mobile devices, there’s no clear cut policy to how applications can adapt with various OS versions and upgrades. One app that runs on this particular version of Android OS may or may not run on another version. Another disadvantage is that since mobile devices such as phones and tabs come in different sizes and forms, it poses a challenge for developers to create apps that can adjust correctly to the right screen size and other varying features and specs.17) What is adb?Adb is short for Android Debug Bridge. It allows developers the power to execute remote shell commands. Its basic function is to allow and control communication towards and from the emulator port.18) What are the four essential states of an activity?- Active – if the activity is at the foreground- Paused – if the activity is at the background and still visible- Stopped – if the activity is not visible and therefore is hidden or obscured by another activity- Destroyed – when the activity process is killed or completed terminated19) What is ANR?ANR is short for Application Not Responding. This is actually a dialog that appears to the user whenever an application have been unresponsive for a long period of time.20) Which elements can occur only once and must be present?Among the different elements, the and elements must be present and can occur only once. The rest are optional, and can occur as many times as needed.21) How are escape characters used as attribute?Escape characters are preceded by double backslashes. For example, a newline character is created using ‘\\n’22) What is the importance of settings permissions in app development?Permissions allow certain restrictions to be imposed primarily to protect data and code. Without these, codes could be compromised, resulting to defects in functionality.23) What is the function of an intent filter?Because every component needs to indicate which intents they can respond to, intent filters are used to filter out intents that these components are willing to receive. One or more intent filters are possible, depending on the services and activities that is going to make use of it.24) Enumerate the three key loops when monitoring an activity- Entire lifetime – activity happens between onCreate and onDestroy- Visible lifetime – activity happens between onStart and onStop- Foreground lifetime – activity happens between onResume and onPause25) When is the onStop() method invoked?A call to onStop method happens when an activity is no longer visible to the user, either because another activity has taken over or if in front of that activity.26) Is there a case wherein other qualifiers in multiple resources take precedence over locale?Yes, there are actually instances wherein some qualifiers can take precedence over locale. There are two known exceptions, which are the MCC (mobile country code) and MNC (mobile network code) qualifiers.27) What are the different states wherein a process is based?There are 4 possible states:- foreground activity- visible activity- background activity- empty process28) How can the ANR be prevented?One technique that prevents the Android system from concluding a code that has been responsive for a long period of time is to create a child thread. Within the child thread, most of the actual workings of the codes can be placed, so that the main thread runs with minimal periods of unresponsive times.29) What role does Dalvik play in Android development?Dalvik serves as a virtual machine, and it is where every Android application runs. Through Dalvik, a device is able to execute multiple virtual machines efficiently through better memory management.30) What is the AndroidManifest.xml?This file is essential in every application. It is declared in the root directory and contains information about the application that the Android system must know before the codes can be executed.31) What is the proper way of setting up an Android-powered device for app development? The following are steps to be followed prior to actual application development in an Android-powered device:-Declare your application as "debuggable" in your Android Manifest.-Turn on "USB Debugging" on your device.-Set up your system to detect your device.32) Enumerate the steps in creating a bounded service through AIDL.1. create the .aidl file, which defines the programming interface2. implement the interface, which involves extending the inner abstract Stub class as well as implanting its methods.3. expose the interface, which involves implementing the service to the clients.33) What is the importance of Default Resources?When default resources, which contain default strings and files, are not present, an error will occur and the app will not run. Resources are placed in specially named subdirectories under the project res/ directory.34) When dealing with multiple resources, which one takes precedence?Assuming that all of these multiple resources are able to match the configuration of a device, the ‘locale’ qualifier almost always takes the highest precedence over the others.35) When does ANR occur?The ANR dialog is displayed to the user based on two possible conditions. One is when there is no response to an input event within 5 seconds, and the other is when a broadcast receiver is not done executing within 10 seconds.36) What is AIDL?AIDL, or Android Interface Definition Language, handles the interface requirements between a client and a service so both can communicate at the same level through interprocess communication or IPC. This process involves breaking down objects into primitives that Android can understand. This part is required simply because a process cannot access the memory of the other process.37) What data types are supported by AIDL?AIDL has support for the following data types:-string-charSequence-List-Map-all native Java data types like int,long, char and Boolean38) What is a Fragment?A fragment is a part or portion of an activity. It is modular in a sense that you can move around or combine with other fragments in a single activity. Fragments are also reusable.39) What is a visible activity?A visible activity is one that sits behind a foreground dialog. It is actually visible to the user, but not necessarily being in the foreground itself.40) When is the best time to kill a foreground activity?The foreground activity, being the most important among the other states, is only killed or terminated as a last resort, especially if it is already consuming too much memory. When a memory paging state has been reach by a foreground activity, then it is killed so that the user interface can retain its responsiveness to the user.41) Is it possible to use or add a fragment without using a user interface?Yes, it is possible to do that, such as when you want to create a background behavior for a particular activity. You can do this by using add(Fragment,string) method to add a fragment from the activity.42) How do you remove icons and widgets from the main screen of the Android device?To remove an icon or shortcut, press and hold that icon. You then drag it downwards to the lower part of the screen where a remove button appears.43) What are the core components under the Android application architecture?There are 5 key components under the Android application architecture:- services- intent- resource externalization- notifications- content providers44) What composes a typical Android application project?A project under Android development, upon compilation, becomes an .apk file. This apk file format is actually made up of the AndroidManifest.xml file, application code, resource files, and other related files.45) What is a Sticky Intent?A Sticky Intent is a broadcast from sendStickyBroadcast() method such that the intent floats around even after the broadcast, allowing others to collect data from it.46) Do all mobile phones support the latest Android operating system?Some Android-powered phone allows you to upgrade to the higher Android operating system version. However, not all upgrades would allow you to get the latest version. It depends largely on the capability and specs of the phone, whether it can support the newer features available under the latest Android version.47) What is portable wi-fi hotspot?Portable Wi-Fi Hotspot allows you to share your mobile internet connection to other wireless device. For example, using your Android-powered phone as a Wi-Fi Hotspot, you can use your laptop to connect to the Internet using that access point.48) What is an action?In Android development, an action is what the intent sender wants to do or expected to get as a response. Most application functionality is based on the intended action.49) What is the difference between a regular bitmap and a nine-patch image?In general, a Nine-patch image allows resizing that can be used as background or other image size requirements for the target device. The Nine-patch refers to the way you can resize the image: 4 corners that are unscaled, 4 edges that are scaled in 1 axis, and the middle one that can be scaled into both axes.50) What language is supported by Android for application development?The main language supported is Java programming language. Java is the most popular language for app development, which makes it ideal even for new Android developers to quickly learn to create and deploy applications in the Android environment.Guru99 Provides FREE ONLINE TUTORIAL on Various courses likeJava MIS MongoDB BigData CassandraWeb Services SQLite JSP Informatica AccountingSAP Training Python Excel ASP Net HBase ProjectTest Management Business Analyst Ethical Hacking PMP ManagementLive Project SoapUI Photoshop Manual Testing Mobile TestingData Warehouse R Tutorial Tableau DevOps AWSJenkins Agile Testing RPA JUnitSoftware EngineeringSelenium CCNA AngularJS NodeJS PLSQL。
Android2.2——API中文文档LLGYZB@目录:(1)—— TextView(2)—— EditText(3)—— AccessibilityService(4)—— Manifest(5)—— View(6)—— ImageView(7)—— ImageButton(8)—— QuickContactBadge(9)—— ZoomButton(10)—— CheckBox(11)—— RadioButton(12)—— Button(13)—— ToggleButton(14)—— ViewStub(15)——GridView一、TextView1、结构ng.Object↳android.view.View↳android.widget.TextView2、已知直接子类:Button, CheckedTextView, Chronometer, DigitalClock, EditText3、已知间接子类:AutoCompleteTextView, CheckBox, CompoundButton, ExtractEditText,MultiAutoCompleteTextView, RadioButton, ToggleButton二、EditText1、结构ng.Object↳ android.view.View↳android.widget.TextView↳ android.widget.EditText已知直接子类:AutoCompleteTextView, ExtractEditText已知间接子类: MultiAutoCompleteTextView2、xml 属性补充说明:a).由于是继承自TextView,所以属性是一样的,但是这里重点补充了输入法相关的属性说明和研究,部分注释也做了相应的调整。
b).Word格式下载/source/26641643、例子3.1<!--[endif]-->android:imeOptions例子<EditText android:id="@+id/txtTest" android:imeOptions="actionGo" android:layout_width="100dp" android:layout_height="wrap_con tent"></EditText>((EditText)findViewById(R.id.txtTest)).setOnEditorActionListener( new TextView.OnEditorActionListener() {@Overridepublic boolean onEditorAction(TextView v, int actionI d,KeyEvent event) {if (actionId == EditorInfo.IME_ACTION_GO) {Toast.makeText(TestActivity.this, "你点了Go!", Toast.LENGTH_SHORT).show();}return false;}});三、AccessibilityService1、结构ng.Object↳android.content.Context↳android.content.ContextWrapper↳android.app.Service↳android.accessibilityservice.AccessibilityServicepublic abstract class AccessibilityService extends Service2、类概述当AccessibilityEvent事件被启动后AccessibilityService 会接收回调函数运行于后台,这些事件指的是在用户接口间的状态转换,比如,焦点变化,按钮被点击等。
一些辅助服务继承于此类并且实现它的抽象方法,像这样的一个服务和其他服务一样在AndroidManifest.xml中被声明但它必须被指定操纵android.accessibilityservice.AccessibilityService的意图,下面的是一段例子:<service android:name=".MyAccessibilityService"><intent-filter><action android:name="android.accessibilityservice.AccessibilityServi ce"/></intent-filter></service>辅助服务的声明周期只能被系统管理,启动或者停止这个服务必须由明确的用户通过启用或停用设备的设定,在系统通过呼叫onServiceConnected()方法与服务绑定后,这个方法才能被想要执行装载的客户端所重载使用,一个辅助服务通过呼叫setServiceInfo(AccessibilityServiceInfo)方法来设定AccessibilityServiceInfo而配置。
你可以在任何时候改变这个服务的配置但最好是在重载方法onServiceConnected().中来使用。
一个辅助服务可以在特定的包中注册事件以提供特殊的反馈类型并且当最后一个关联的事件被解除的时候发出明确的超时提醒。
3、通告策略对于每个回馈类型只有一个辅助服务被通知,服务登记处按顺序被通知,因此,如果有两个服务为同一个包中的同一回馈类型注册那么第一个会被通知,然而有可能的是,可以为一个给定的回馈类型去把一个服务注册为默认的,这样的话如果没有其他的服务来取代这个事件这个服务就会被呼出使用,换句话说,默认的服务不会与其他的服务竞争并且不管注册的顺序而被通知。
4、公共方法:4.1 abstract void onAccessibilityEvent(AccessibilityEvent event)Callback for AccessibilityEvents.参数event 一个事件4.2 public final IBinder onBind (Intent intent)实现返回一个内部的辅助接口的实现,子类不能被重写。
参数 intent 与服务相绑定的意图,注意其他任何包含在Intent的外部意图将不能在此使用。
返回值返回一个客户端可以在服务上访问的IBinder。
4.3 public abstract void onInterrupt ()打断辅助回馈内容时呼叫。
5、保护方法:5.1 protected void onServiceConnected ()这个方法是AccessibilityService声明周期的一部分,在系统成功与服务绑定后才被呼叫,如果用来设定AccessibilityServiceInfo.这个方法更为方便。
四、Mainfest1、结构ng.Object↳ android.Manifestpublic final class Manifest extends Object 内部类Manifest.permissionManifest.permission_group2、Manifest.permission的常量<!--[endif]-->3、Manifest.permission_group的常量<!--[endif]-->五、View1、结构ng.Object↳ android.view.View已知直接子类:AnalogClock, ImageView, KeyboardView, ProgressBar, SurfaceView, TextView, ViewGroup, ViewStub已知间接子类:AbsListView, AbsSeekBar, AbsSpinner, AbsoluteLayout, AdapterView<T extends Adapter>, AppWidgetHostView, AutoCompleteTextView, Button, CheckBox, CheckedTextView, Chronometer, CompoundButton, DatePicker, DialerFilter, DigitalClock, EditText, ExpandableListView, ExtractEditText, FrameLayout, GLSurfaceView, Gallery, GestureOverlayView, GridView, HorizontalScrollView, ImageButton, ImageSwitcher, LinearLayout, ListView, MediaController, MultiAutoCompleteTextView, QuickContactBadge, RadioButton, RadioGroup, RatingBar, RelativeLayout, ScrollView, SeekBar, SlidingDrawer, Spinner, TabHost, TabWidget, TableLayout, TableRow, TextSwitcher, TimePicker, ToggleButton, TwoLineListItem, VideoView, ViewAnimator, ViewFlipper, ViewSwitcher, WebView, ZoomButton, ZoomControls2、xml属性设置底部的边距,以像素为单位填充空白。
3、公共方法(部分)boolean awakenScrollBars()boolean awakenScrollBars(int startDelay, boolean invalidate)boolean awakenScrollBars(int startDelay)int computeHorizontalScrollExtent()int computeHorizontalScrollOffset()int computeHorizontalScrollRange()int computeVerticalScrollExtent()int computeVerticalScrollOffset()int computeVerticalScrollRange()void dispatchDraw(Canvas canvas)void dispatchRestoreInstanceState(SparseArray<Parcelable> container) void dispatchSaveInstanceState(SparseArray<Parcelable> container)void dispatchSetPressed(boolean pressed)void dispatchSetSelected(boolean selected)void dispatchVisibilityChanged(View changedView, int visibility)void drawableStateChanged()boolean fitSystemWindows(Rect insets)float getBottomFadingEdgeStrength()int getBottomPaddingOffset()ContextMenu.ContextMenuInfo getContextMenuInfo()int getHorizontalScrollbarHeight()float getLeftFadingEdgeStrength()int getLeftPaddingOffset()float getRightFadingEdgeStrength()int getRightPaddingOffset()int getSuggestedMinimumHeight()int getSuggestedMinimumWidth()float getTopFadingEdgeStrength()int getTopPaddingOffset()int getWindowAttachCount()void initializeFadingEdge(TypedArray a)void initializeScrollbars(TypedArray a)boolean isPaddingOffsetRequired()static int[] mergeDrawableStates(int[] baseState, int[] additionalState)void onAnimationEnd()void onAnimationStart()void onAttachedToWindow()void onConfigurationChanged(Configuration newConfig)void onCreateContextMenu(ContextMenu menu)int[] onCreateDrawableState(int extraSpace)void onDetachedFromWindow()void onDisplayHint(int hint)void onDraw(Canvas canvas)final void onDrawScrollBars(Canvas canvas)void onFinishInflate()void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect)void onLayout(boolean changed, int left, int top, int right, int bottom)void onMeasure(int widthMeasureSpec, int heightMeasureSpec)void onRestoreInstanceState(Parcelable state)Parcelable onSaveInstanceState()void onScrollChanged(int l, int t, int oldl, int oldt)boolean onSetAlpha(int alpha)void onSizeChanged(int w, int h, int oldw, int oldh)void onVisibilityChanged(View changedView, int visibility)void onWindowVisibilityChanged(int visibility)final void setMeasuredDimension(int measuredWidth, int measuredHeight)boolean verifyDrawable(Drawable who)4、代码4.1android:duplicateParentState<LinearLayout android:clickable="true" android:background="#ff0fff" android:layout_width="100dp" android:layout_height="100dp"> <Button android:duplicateParentState="true" android:layout_width="wrap_content" android:layout_height="wrap_content"/></LinearLayout>4.2android:scrollbars<EditText android:layout_width="fill_parent"android:layout_height="wrap_content" android:minHeight="50dp" android:background="@android:drawable/editbox_background"android:scrollbars="vertical"android:maxLines="4"></EditText>5、遗留问题5.1以下几个属性翻遍了资料试了很多次都没有效果,只能暂时搁置,以后补上,也欢迎的大家提供意见和线索,分享大家的经验:android:scrollbarAlwaysDrawHorizontalTrackandroid:scrollbarAlwaysDrawVerticalTrackandroid:isScrollContainer六、ImagesView2、结构ng.Object↳android.view.View↳android.widget.ImageView已知直接子类:ImageButton, QuickContactBadge已知间接子类:ZoomButton2、类概述显示任意图像,例如图标。