共计 1359 个字符,预计需要花费 4 分钟才能阅读完成。
AndroidManifest.xml 介绍
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.xiaojianbang.hashmaptest"> | |
<application | |
android:allowBackup="true" | |
android:icon="@mipmap/ic_launcher" | |
android:label="@string/app_name" | |
android:roundIcon="@mipmap/ic_launcher_round" | |
android:supportsRtl="true" | |
android:theme="@style/Theme.HashMapTest" | |
android:name=".MyApplication"> | |
<activity android:name=".MainActivity"> | |
<intent-filter> | |
<action android:name="android.intent.action.MAIN" /> | |
<category android:name="android.intent.category.LAUNCHER" /> | |
</intent-filter> | |
</activity> | |
</application> | |
</manifest> | |
根节点是 manifest,根节点的 package 属性指定包名,根节点下又有若干子节点 | |
user-permission 申明 app 运行须要的权限 | |
application 指定 app 本身属性 | |
android:allowBackup 是否容许备份 | |
android:icon 在手机屏幕上的图标 | |
android:label 在手机屏幕上显示的名称 | |
android:supportsRtl 是否反对从右往左的文字排列程序 | |
android:theme 显示主题 | |
android:name 可选,个别加固利用都会有这个,这里定义的类比 activity 先执行 | |
application 中还有若干字节点,比方四大组件的注册 | |
<activity android:name=".MainActivity"> | |
示意这是一个界面,对应类名是以后包名门路下的 MainActivity | |
<category android:name="android.intent.category.LAUNCHER" /> | |
带有这一条的界面,是启动界面入口 | |
带有 LAUNCHER 的 activity 对应的类,先执行。如果后面有 android:name,那么它对应的类会优先执行。 |
2. 事件执行程序
Application static
Application attachBaseContext
Application onCreate
MainActivity static
MainActivity attachBaseContext
MainActivity onCreate
3. Application 的生命周期很长,能够用来传递一些全局变量
public static HashMap<String, String> mInfoMap = new HashMap<>();
定义动态变量,别的类中间接通过类名援用
正文完