Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/185.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android中的动作、类别、活动名称有什么区别?_Android_Android Activity_Android Manifest - Fatal编程技术网

Android中的动作、类别、活动名称有什么区别?

Android中的动作、类别、活动名称有什么区别?,android,android-activity,android-manifest,Android,Android Activity,Android Manifest,有安卓:名称3次,它们之间有什么区别?我开始学习Android,所以现在我正在努力理解它 <activity android:name="com.example.project.MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action

有安卓:名称3次,它们之间有什么区别?我开始学习Android,所以现在我正在努力理解它

  <activity
        android:name="com.example.project.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>


活动是您提供给用户的用户界面。意图过滤器就像一个“端口”,您可以将活动添加到其中,并允许其他应用程序搜索在“端口”上运行的所有应用程序并调用它们。动作名称正是应用程序被调用时要执行的操作。

每个意图过滤器由应用程序清单文件中的
元素定义,嵌套在相应的应用程序组件中(例如
元素)

  • 行动:
    name
    属性中声明接受的意图操作。该值必须是操作的文字字符串值,而不是类常量

  • 类别:
    name
    属性中声明接受的意图类别。该值必须是操作的文字字符串值,而不是类常量

  • android:name 操作的名称。一些标准动作在Intent类中定义为
    ACTION\u string
    常量。要将其中一个操作分配给此属性,请在
    操作
    后面的字符串前面加上“
    ”android.intent.action.”


例如,对于
ACTION\u MAIN
,使用
“android.intent.ACTION.MAIN”
;对于
ACTION\u WEB\u SEARCH
,使用
“android.intent.ACTION.WEB\u SEARCH”
android
是包,
name
是字段。在XML中,您可以这样编写完全访问:
android.name

。检查这个和这个