SYNTAX:
<intent-filter android:icon="drawable resource"       android:label="string resource"       android:priority="integer" >  . . .</intent-filter>
CONTAINED IN:
<activity>
<activity-alias>
<service>
<receiver>
MUST CONTAIN:
<action>
CAN CONTAIN:
<category>
<data>
DESCRIPTION:
Specifies the types of intents that an activity, service, or broadcast receiver can respond to. An intent filter declares the capabilities of its parent component — what an activity or service can do and what types of broadcasts a receiver can handle. It opens the component to receiving intents of the advertised type, while filtering out those that are not meaningful for the component.

Most of the contents of the filter are described by its<action>,<category>, and<data>subelements.

For a more detailed discussion of filters, see the separateIntents and Intent Filtersdocument, as well as theIntents Filterssection in the introduction.

ATTRIBUTES:
android:icon
An icon that represents the parent activity, service, or broadcast receiver when that component is presented to the user as having the capability described by the filter.

This attribute must be set as a reference to a drawable resource containing the image definition. The default value is the icon set by the parent component'siconattribute. If the parent does not specify an icon, the default is the icon set by the<application>element.

For more on intent filter icons, seeIcons and Labelsin the introduction.

android:label
A user-readable label for the parent component. This label, rather than the one set by the parent component, is used when the component is presented to the user as having the capability described by the filter.

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.

The default value is the label set by the parent component. If the parent does not specify a label, the default is the label set by the<application>element'slabelattribute.

For more on intent filter labels, seeIcons and Labelsin the introduction.

android:priority
The priority that should be given to the parent component with regard to handling intents of the type described by the filter. This attribute has meaning for both activities and broadcast receivers:
  • It provides information about how able an activity is to respond to an intent that matches the filter, relative to other activities that could also respond to the intent. When an intent could be handled by multiple activities with different priorities, Android will consider only those with higher priority values as potential targets for the intent.
  • It controls the order in which broadcast receivers are executed to receive broadcast messages. Those with higher priority values are called before those with lower values. (The order applies only to synchronous messages; it's ignored for asynchronous messages.)

Use this attribute only if you really need to impose a specific order in which the broadcasts are received, or want to force Android to prefer one activity over others.

The value must be an integer, such as "100". Higher numbers have a higher priority. The default value is 0. The value must be greater than -1000 and less than 1000.

Also seesetPriority().

INTRODUCED IN:
API Level 1
SEE ALSO:
<action>
<category>
<data>

句法:
<意向过滤器 的android:图标 = 绘制资源       机器人:标签 = 字符串资源       机器人:优先 = 整数 >   。。。</意图过滤器>
包含在:
<活动>
<活性别名>
<服务>
<接收器>
必须包含:
<动作>
可以包含:
<category>中
<数据>
描述:
指定类型的活动,服务或广播接收机可响应意图的。一个意图过滤器声明其父组件的功能 - 有什么活动或服务可以做,一个接收器能够处理什么类型的广播。它打开组件于接收播发类型的意图,同时过滤掉那些没有意义的部件。

大部分过滤器的内容由其描述<动作><category>中,而<数据>子元素。

有关过滤器更详细的讨论,参见单独的意图和意图过滤器的文件,以及该意图过滤器的介绍部分。

属性:
安卓图标
表示父活动,服务或广播接收机时该组件被呈现给用户作为具有由过滤器所描述的能力的图示。

此属性必须设置为包含图像定义的可绘制资源的引用。默认值是由父组件的设置图标图标属性。如果家长不指定一个图标,默认是由设置图标<应用程序>元素。

欲了解更多关于意图过滤器图标,请参见图标和标签中的介绍。

机器人:标签
父组件的用户可读的标签。这种标签,而不是一个接父组件设置中,当组件被呈现给用户作为具有由过滤器所描述的能力被使用。

标签应设置为一个字符串资源的引用,以便它可以被本地化一样在用户界面的其他串。但是,作为一种方便,而你开发的应用程序,它也可以被设置为一个原始字符串。

默认值是标签由父组件集。如果家长不指定标签,默认为标签的设定<应用程序>元素的标签属性。

欲了解更多关于意图过滤器标签,看图标和标签中的介绍。

机器人:优先
应给予父组件关于处理由滤波器所描述的类型的意图的优先级。此属性才有意义为活动和广播接收器:
  • 它提供有关一个活动是如何能够以该过滤器,相对于其他活动也可向意图响应相匹配的意图做出响应的信息。当一个意图可以通过具有不同优先级的多个活动来处理,Android将只考虑那些具有较高优先级的值作为意向的潜在目标。
  • 它控制在广播接收机执行接收广播消息的顺序。那些具有更高的优先级值那些低价值之前​​被调用。(该命令只适用于同步消息;它是异步消息忽略)。

只有当你真正需要施加在该广播接收特定的顺序,或者想迫使Android的喜欢一个活动对他人使用该属性。

该值必须是一个整数,如“100”。数值越大,有更高的优先级。缺省值为0的值必须大于-1000和小于1000。

另见setPriority()

介绍了:
API级别1
也可以看看:
<操作>
<类别>
<数据>

更多相关文章

  1. data
  2. 【android】类似微信底部按钮标签实现
  3. Android(安卓)自定义标签 Imagebutton实现ImageButton里放置文字
  4. Android开发21——隐式意图
  5. 意图对象传递数据
  6. 2018年 第二波~Android(安卓)库
  7. Android(安卓)UI (include的使用)
  8. Android(安卓)开发过程中遇到的各类问题总结
  9. Android实现倒计时跳转Activity

随机推荐

  1. 【Android】音效配置文件 audio_effects.
  2. android Gridview生成程序快捷键的复杂方
  3. Android(安卓)studio报错module not spec
  4. Android下Xml解析技术(四)、pull生成Xml文
  5. get方式和post方式的请求
  6. Android(安卓)ActionBar与ViewPager合用
  7. 较深入的分析Content Providers用法
  8. Android(安卓)ListView元素间隙线自定义
  9. Android传感器的介绍
  10. Android(安卓)实时视频采集—Cameara预览