• 安卓开发_浅谈主配置文件(AndroidManifest.xml)


    AndroidManifest.xml
    本质:是整个应用的主配置清单文件
    包含:该应用的包名,版本号,组件,权限等信息
    作用:记录该应用的相关的配置信息

    一、常用标签
    (1)、全局篇(包名,版本信息)
    (2)、组件篇(四大组件)、
    (3)、权限篇(申请权限和定义权限)
    1、全局篇
    (1)、应用的包名以及版本信息的管理
    package="com.example.tset"
    android:versionCode="1"
    android:versionName="1.0">
    (2)、控制android版本的信息(可以支持的最低版本,你期望的系统版本)
    android:minSdkVersion="8"
    android:targetSdkVersion="16"
    2、组件篇
    <application android:icon="@drawable/icon"
    android:theme="@style/my_theme">
    </application>
    其属性可以设置:
    (1)、图标:android:icon
    (2)、标题:android;label
    (3)、主题样式:android:theme

    在配置文件中注册组件

    (1)、定义Activity

    <activity
    android:name="com.example.allcode.MainActivity"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.Dialog"
    >

    <intent-filter>
    <action android:name="android.intent.action.MAIN" /> //作为主activity
    <category android:name="android.intent.category.LAUNCHER" /> //显示在软件列表中
    </intent-filter>
    </activity>
    注:启动一个没有在清单中定义的Activity会抛出异常
    (2)、定义Service(服务)
    <sevice android:name="com.ttg.service.CouponService"
    <intent-filter>
    <action android:name="com.ttg.service"</action>
    </intent-filter>
    </seivice>
    (3)、Content Provider(内容提供者)
    <provider android:name="com.example.manifest.provider">
    </provider>
    内容提供者用来管理数据库访问及程序内和程序间共享的
    (4)、Broadcast Receiver(广播接收者)
    <receiver android:name="com.ttg.receiver.CouponService"
    <intent-filter>
    <action android:name="com.ttg.install"</action>
    </intent-filter>
    </receiver>

  • 相关阅读:
    2020暑假牛客多校9 B
    2020暑假牛客多校10 C -Decrement on the Tree (边权转点权处理)
    HDU 5876 补图的最短路
    CSP初赛复习
    遗传算法
    排列组合
    和式 sigma的使用
    多项式的各种操作
    三分
    NOIP2018普及游记
  • 原文地址:https://www.cnblogs.com/xqxacm/p/4564332.html
Copyright © 2020-2023  润新知