src :
http://dan.febird.net/2011/08/52356-google-voice-talk-all-in-one.html
从android系统2.1以后,android新增了方法:overridePendingTransition(int enterAnim, int exitAnim),用于改变Activity之间的切换动画。
从样式里进行改变切换动画
这个主要是加在样式文件里进行更改,代码如下:
<style name="Theme.Test" parent="@android:style/Theme.Light.NoTitleBar"> <item name="android:windowAnimationStyle">@style/Animation.Activity.Test</item> </style>
<style name="Animation.Activity.Test" parent="@android:style/Animation.Activity"> <item name="android:activityOpenEnterAnimation">@anim/activity_open_enter</item> <item name="android:activityOpenExitAnimation">@anim/activity_open_exit</item> <item name="android:activityCloseEnterAnimation">@anim/activity_close_enter</item> <item name="android:activityCloseExitAnimation">@anim/activity_close_exit</item> <item name="android:taskOpenEnterAnimation">@anim/activity_open_enter</item> <item name="android:taskOpenExitAnimation">@anim/activity_open_exit</item> <item name="android:taskCloseEnterAnimation">@anim/activity_close_enter</item> <item name="android:taskCloseExitAnimation">@anim/activity_close_exit</item> <item name="android:taskToFrontEnterAnimation">@anim/activity_open_enter</item> <item name="android:taskToFrontExitAnimation">@anim/activity_open_exit</item> <item name="android:taskToBackEnterAnimation">@anim/activity_close_enter</item> <item name="android:taskToBackExitAnimation">@anim/activity_close_exit</item> </style>
只要这样进行配置,那边Activity之间的切换动画都可以进行自定义了
程序里动态的进行改变切换动画
如果程序中还有一些地方需要单独进行更改动画,则可以在程序里进行更改:
1. 由A跳到B的动画:
startActivity(new Intent(A.this, B.class)); overridePendingTransition(inAnim, outAnim);
2. 由B回到A的动画:
finish(); activity.overridePendingTransition(inAnim, outAnim);
加了Dialog样式的Activity的情况
如果在Activity的样式文件里,加入了下面的代码,则Activity就会出现Dailog的样式了:
<item name="android:windowIsTranslucent">true</item>
加入了这句话,按正常情况,应该不会再执行你设置的Activity的切换动画,但有时也会执行Activity之间的切入动画(有可能在程序第一次启动时),所以最好在代码里也加上overridePendingTransition()方法,进行动态进行设置。
总结:Activity之间的动画,是拿整个界面执行动画(包括通知栏),所以如果你执行向下切换动画,会看到白色的状态栏,这个我没有找到解决办法。
【翻译】(60)provider元素
see
http://developer.android.com/guide/topics/manifest/provider-element.html
原文见
http://developer.android.com/guide/topics/manifest/provider-element.html
-------------------------------
<provider>
provider元素
-------------------------------
* syntax:
* 语法:
-------------------------------
<provider android:authorities="list"
android:enabled=["true" | "false"]
android:exported=["true" | "false"]
android:grantUriPermissions=["true" | "false"]
android:icon="drawable resource"
android:initOrder="integer"
android:label="string resource"
android:multiprocess=["true" | "false"]
android:name="string"
android:permission="string"
android:process="string"
android:readPermission="string"
android:syncable=["true" | "false"]
android:writePermission="string" >
. . .
</provider>
-------------------------------
* contained in:
* 被包含在:
<application>
* can contain:
* 可以包含:
<meta-data>
<grant-uri-permission>
<path-permission>
* description:
* 描述:
Declares a content provider — a subclass of ContentProvider — that supplies structured access to data managed by the application. All content providers that are part of the application must be represented by <provider> elements in the manifest file. The system cannot see, and therefore will not run, any that are not declared. (You need to declare only those content providers that you develop as part of your application, not those developed by others that your application uses.)
声明一个内容提供者——ContentProvider的子类——它提供对被应用程序管理的数据的结构化访问。所有属于应用程序一部分的内容提供者必须通过清单文件中的<provider>元素来呈现。系统不能看到任何未被声明的内容提供者,因此将不运行未被声明的内容提供者。(你只需要声明那些你开发作为你的应用程序一部分的内容提供者,而不需要声明你的应用程序使用的被其它人开发的那些。)
The Android system identifies content providers by the authority part of a content: URI. For example, suppose that the following URI is passed to ContentResolver.query():
Android系统通过content: URI的权力部分来标识内容提供者。例如,假设以下URI被传递给ContentResolver.query():(注:health care是医疗保健,nurses是护士)
content://com.example.project.healthcareprovider/nurses/rn
The content: scheme identifies the data as belonging to a content provider and the authority (com.example.project.healthcareprovider) identifies the particular provider. The authority therefore must be unique. Typically, as in this example, it's the fully qualified name of a ContentProvider subclass. The path part of a URI may be used by a content provider to identify particular data subsets, but those paths are not declared in the manifest.
content:模式标识数据是属于一个内容提供者的而权力(com.example.project.healthcareprovider)标识特定的提供者。因此权力必须是唯一的。典型地,正如这个例子中所示,它是一个ContentProvider子类的完全修饰名称。URI的路径部分可能被一个内容提供者使用以标识特定数据子集,但在清单中那些路径没有被声明。
For information on using and developing content providers, see a separate document, Content Providers.
想获得关于使用和开发内容提供者的信息,参见分离的文档,内容提供者。
* attributes:
* 属性:
* android:authorities
A list of one or more URI authorities that identify data under the purview of the content provider. Multiple authorities are listed by separating their names with a semicolon. To avoid conflicts, authority names should use a Java-style naming convention (such as com.example.provider.cartoonprovider). Typically, it's the name of the ContentProvider subclass.
一个或多个URI权力的列表,它标识内容提供者范围内的数据。多个权力通过用分号分隔它们的名称来列举。为了避免冲突,权力名称应该使用一个Java风格命名约定(诸如com.example.provider.cartoonprovider)。典型地,它是ContentProvider子类的名称。
There is no default. At least one authority must be specified.
没有默认值。必须指定至少一个权力。
* android:enabled
Whether or not the content provider can be instantiated by the system — "true" if it can be, and "false" if not. The default value is "true".
内容提供者是否可以被系统实例化——"true"如果它可以,而"false"如果它不可以。默认值为"true"。
The <application> element has its own enabled attribute that applies to all application components, including content providers. The <application> and <provider> attributes must both be "true" (as they both are by default) for the content provider to be enabled. If either is "false", the provider is disabled; it cannot be instantiated.
<application>元素拥有它自己的enabled属性,它被应用到所有应用程序组件。包括内容提供者。<application>和<provider>属性必须都是"true"(默认它们都是)以让内容提供者被使能。如果其中一个是"false",提供者被屏蔽;它不允许被实例化。
* android:exported
Whether or not the content provider can be used by components of other applications — "true" if it can be, and "false" if not. If "false", the provider is available only to components of the same application or applications with the same user ID. The default value is "true".
内容提供者是否可以被其它应用程序的组件使用——"true"如果它可以,而"false"如果它不可以。如果"false",那么提供者只对于相同应用程序或带有相同用户ID的应用程序的组件可用。默认值为"true"。
You can export a content provider but still limit access to it with the permission attribute.
你可以导出一个内容提供者但仍然用permission属性限制对它的访问。
* android:grantUriPermissions
Whether or not those who ordinarily would not have permission to access the content provider's data can be granted permission to do so, temporarily overcoming the restriction imposed by the readPermission, writePermission, and permission attributes — "true" if permission can be granted, and "false" if not. If "true", permission can be granted to any of the content provider's data. If "false", permission can be granted only to the data subsets listed in <grant-uri-permission> subelements, if any. The default value is "false".
平常不会拥有权限访问内容提供者数据的那些东西是否可以被授权权限来做这些事,临时地跨越readPermission,writePermission和permission属性的限制——"true"如果权限可以被授权,而"false"如果不可以。如果"true",那么权限可以被授权给内容提供者的任意数据。如果"false",那么权限可以被授权仅对于在<grant-uri-permission>子元素中列举的数据子集,如果有的话。默认值为"false"。
Granting permission is a way of giving an application component one-time access to data protected by a permission. For example, when an e-mail message contains an attachment, the mail application may call upon the appropriate viewer to open it, even though the viewer doesn't have general permission to look at all the content provider's data.
授权权限是给予一个应用程序组件对于被权限保护的数据一次性访问权的一种方式。例如,当一个电子邮件消息包含一个附件时,邮件应用程序可能调用合适的查看器以打开它,即便查看器没有普通的权限来查看提供者数据的所有数据。
In such cases, permission is granted by FLAG_GRANT_READ_URI_PERMISSION and FLAG_GRANT_WRITE_URI_PERMISSION flags in the Intent object that activates the component. For example, the mail application might put FLAG_GRANT_READ_URI_PERMISSION in the Intent passed to Context.startActivity(). The permission is specific to the URI in the Intent.
在这些情况下,权限通过激活组件的Intent对象中的FLAG_GRANT_READ_URI_PERMISSION和FLAG_GRANT_WRITE_URI_PERMISSION标志来授权。例如,邮件应用程序可能放置FLAG_GRANT_READ_URI_PERMISSION在传给Context.startActivity()的Intent对象中。权限被指定到Intent里的URI。
If you enable this feature, either by setting this attribute to "true" or by defining <grant-uri-permission> subelements, you must call Context.revokeUriPermission() when a covered URI is deleted from the provider.
如果你要么通过设置属性为"true"要么通过定义<grant-uri-permission>子元素来使能这个特性,那么你必须在一个被涵盖的URI从提供者中被删除的时候调用Context.revokeUriPermission()。
See also the <grant-uri-permission> element.
另见<grant-uri-permission>元素。
* android:icon
An icon representing the content provider. This attribute must be set as a reference to a drawable resource containing the image definition. If it is not set, the icon specified for the application as a whole is used instead (see the <application> element's icon attribute).
代表内容提供者的图标。这个属性必须被设置作为指向包含图片定义的可绘画对象资源的引用。如果它没有被设置,那么改为使用为应用程序整体指定的图标。(见<application>元素的icon属性)。
* android:initOrder
The order in which the content provider should be instantiated, relative to other content providers hosted by the same process. When there are dependencies among content providers, setting this attribute for each of them ensures that they are created in the order required by those dependencies. The value is a simple integer, with higher numbers being initialized first.
内容提供者应该被实例化的次序,相对于同一个进程持有的其它内容提供者。当内容提供者之间存在依赖时,为它们中的每个设置这个属性来确保它们依照那些依赖所需的次序来被创建。值是一个简单整数,带较高数值的被最先初始化。
* android:label
A user-readable label for the content provided. If this attribute is not set, the label set for the application as a whole is used instead (see the <application> element's label attribute).
用于内容提供者(注:provided应作provider)的用户可读标签。如果这个属性没有被设置,那么改为使用为应用程序整体设置的标签(见<application>元素的label属性)。
The label should be set as a reference to a string resource, so that it can be localized like other strings in the user interface. However, as a convenience while you're developing the application, it can also be set as a raw string.
标签应该被设置作为指向字符串资源的引用,使它可以像用户界面中的其它字符串那样被本地化。然而,作为便利当你正在开发应用程序时,它还可以被设置作为一个原始字符串。
* android:multiprocess
Whether or not an instance of the content provider can be created in every client process — "true" if instances can run in multiple processes, and "false" if not. The default value is "false".
内容提供者的实例是否可以被创建在每个客户端进程中——"true"如果多个实例可以运行在多个进程中,而"false"如果不可以。默认值为"false"。
Normally, a content provider is instantiated in the process of the application that defined it. However, if this flag is set to "true", the system can create an instance in every process where there's a client that wants to interact with it, thus avoiding the overhead of interprocess communication.
通常,一个内容提供者在定义它的应用程序的进程中被实例化。如果这个标志被设置为"true",那么系统可以在希望与它交互的每个客户端所在进程中创建一个实例,这样避免进程间通信的开销。
* android:name
The name of the class that implements the content provider, a subclass of ContentProvider. This should be a fully qualified class name (such as, "com.example.project.TransportationProvider"). However, as a shorthand, if the first character of the name is a period, it is appended to the package name specified in the <manifest> element.
实现内容提供者的类,ContentProvider子类的名称。它应该是一个完全修饰名称(诸如,"com.example.project.TransportationProvider")。然而,作为简写,如果名称的第一个字符是一个点,那么它被尾加到<manifest>元素中指定的包名后。
There is no default. The name must be specified.
没有默认值。名称必须被指定。
* android:permission
The name of a permission that clients must have to read or write the content provider's data. This attribute is a convenient way of setting a single permission for both reading and writing. However, the readPermission and writePermission attributes take precedence over this one. If the readPermission attribute is also set, it controls access for querying the content provider. And if the writePermission attribute is set, it controls access for modifying the provider's data.
权限的名称,客户端必须拥有它来读或写内容提供者的数据。这个属性是设置用于读取和写入的单一权限的便利方法。然而,readPermission和writePermission属性持有比它更高的优先级。如果readPermission属性也被设置,那么它控制查询内容提供者的访问权。而且如果writePermission属性被设置,那么它控制修改提供者数据的访问权。(注:请注意“也”)
For more information on permissions, see the Permissions section in the introduction and a separate document, Security and Permissions.
想获得关于权限的更多信息,参见介绍中的权限章节以及单独的文档,安全与权限。
* android:process
The name of the process in which the content provider should run. Normally, all components of an application run in the default process created for the application. It has the same name as the application package. The <application> element's process attribute can set a different default for all components. But each component can override the default with its own process attribute, allowing you to spread your application across multiple processes.
当前提供者应该运行在的进程的名称。通常,一个应用程序的所有组件运行在应用程序的默认进程中。它拥有和应用程序包相同的名称。<application>元素的process属性可以为所有组件设置一个不同的默认值。但每个组件可以用它自己的process属性覆盖默认值,允许你延伸你的应用程序跨多个进程。
If the name assigned to this attribute begins with a colon (':'), a new process, private to the application, is created when it's needed and the activity runs in that process. If the process name begins with a lowercase character, the activity will run in a global process of that name, provided that it has permission to do so. This allows components in different applications to share a process, reducing resource usage.
如果赋予给这个属性的名称以一个冒号(':')开头,那么当需要它而且活动运行在那个进程中时一个对于应用程序私有的新进程被创建。如果进程名称以一个小写字符开头,那么活动将运行在那个名称的一个全局进程中,假设它拥有权限做此事。这允许不同应用程序的组件共享一个进程,降低资源使用率。
* android:readPermission
A permission that clients must have to query the content provider. See also the permission and writePermission attributes.
一个权限,客户端必须拥有它来查询内容提供者。另见permission和writePermission属性。
* android:syncable
Whether or not the data under the content provider's control is to be synchronized with data on a server — "true" if it is to be synchronized, and "false" if not.
在内容提供者的控制下的数据是否打算被服务器上的数据同步——"true"如果它打算被同步,而"false"如果它不打算被同步。
* android:writePermission
A permission that clients must have to make changes to the data controlled by the content provider. See also the permission and readPermission attributes.
一个权限,客户端必须拥有它以对内容提供者控制的数据作出改变。另见permission和readPermission属性。
* introduced in:
* 引入:
API Level 1
API级别1
* see also:
* 另见:
Content Providers 内容提供者
Except as noted, this content is licensed under Apache 2.0. For details and restrictions, see the Content License.
除特别说明外,本文在Apache 2.0下许可。细节和限制请参考内容许可证。
Android 4.0 r1 - 10 Feb 2012 0:44
-------------------------------
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
(此页部分内容基于Android开源项目,以及使用根据创作公共2.5来源许可证描述的条款进行修改)
(本人翻译质量欠佳,请以官方最新内容为准,或者参考其它翻译版本:
* ソフトウェア技術ドキュメントを勝手に翻訳
http://www.techdoctranslator.com/android
* Ley's Blog
http://leybreeze.com/blog/
* 农民伯伯
http://www.cnblogs.com/over140/
* Android中文翻译组
http://androidbox.sinaapp.com/
)