自学第二天(1)

来源:互联网 发布:sql注入防御 编辑:程序博客网 时间:2024/06/06 12:24

     AndroidMainfest.xml清单文件

        1.全局篇

         1)包名、版本信息

                包名:package="  "

                版本号:android:versionCode="1"

                期望版本号:android:versionCodeName="1.0"

         2)AndroidMainfest版本信息

               最低版本: android:minSdkVersion="8"

               期望版本:android:targetSdkVersion="16"

        2.组件篇(四大组件)

              全局只有一个application

               <application android:icon="   " android:theme="   "   android:label="   "></application>

                        icon:图标

                        label:标题

                       theme:主题样式

         1)Activity(活动)

                  启动一个Activity时,没有在清单文件中定义,程序会抛出运行时异常的错误

                  <intent-filter/>:起到一个过滤器的作用,是入口Activity的标识

                  <activity  android:name="  包名+类名"  android:label="  ">

                       <intent-filter>

                            <action android:name=" android.intent.action.MAIN"/>

                           <category android:name="android.intent.actegory.LAUNCHER"/>

                       </intent-filter>

                 </activity>

        2)Service(服务)

               与Activity的显著区别是Activity显示界面,Service是后台逻辑代码的处理

              Service也有<intent-filter>的方法,书写样式同上

       3)Content Provider(内容提供者)

               <provider android:name="  " android:authorities=" "/>

               authorities:是内容提供者特有的属性,含义为书写域名或者地址

             内容提供者是用来管理数据库访问以及程序内和程序间共享的

     4)BroadcastReciver(广播接收者)

           被誉为全局事件监听器,起到介绍、过滤的作用。可以使用代码进行注册,但是其他三大控件必须在AndroidMainfest中书写

1 0
原创粉丝点击