Android-<manifest>

本文深入解析AndroidManifest.xml文件的基本结构与关键属性,包括命名空间、包名、安装位置选择等,同时阐述了其在Android应用开发中的重要角色与作用。

语法:

<manifestxmlns:android="http://schemas.android.com/apk/res/android"
         
package="string"
         
android:sharedUserId="string"
         
android:sharedUserLabel="string resource"
         
android:versionCode="integer"
         
android:versionName="string"
         
android:installLocation=["auto" | "internalOnly" | "preferExternal"] >
    . . .
</manifest>

必须包含:

<application>

可以包含:

<instrumentation>

<permission>

<permission-group>

<permission-tree>

<uses-configuration>

<uses-permission>

<uses-sdk>

描述:

The root element of the AndroidManifest.xml file.  It must  contain an <application> element  and specify xlmns:android and package attributes.

AndroidManifest.xml文件的根元素。它必须包含一个<application>元素,并指定xlmns : Android和包属性。
属性:
 xmlns:android
定义了Android命名空间。此属性应始终设置“ http://schemas.android.com/apk/res/android ” 。
package
一个完整的Java应用程序包名称。的名称应该是唯一的。该名称可以包含大写或小写字母(' A'到' Z“ ) ,数字,下划线( ”_“) 。然而,个别包名称部分可能只用字母开始。例如,由谷歌发布的应用程序可以有形式com.google.app.application_name名称。
包的名称作为一个应用程序的唯一标识符。这也是应用过程中的默认名称(参考<application>元素的进程的process属性)和类同(参考<activity>元素的taskAffinity的属性)一个活动的默认任务。

转载于:https://www.cnblogs.com/chris-cm/archive/2012/05/02/2478632.html

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.example.myapplication" tools:ignore="ExtraText"> <!-- 必须添加包名 --> <!-- 存储权限声明 --> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <!-- Android 10+ 需要添加的权限 --> <uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" /> <!-- Android 13+ 需要添加的权限 --> <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" /> <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.MyApplication"> <!-- 应用主题 --> <!-- 主Activity --> <activity android:name=".BookShelfActivity" android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <!-- 阅读Activity - 添加必要属性 --> <activity android:name=".ReadingActivity" android:exported="false" /><!-- 明确声明是否允许外部启动 --> android:configChanges="orientation|screenSize" <!-- 防止旋转重建 --> android:screenOrientation="portrait" <!-- 固定竖屏 --> android:windowSoftInputMode="adjustPan"/> <!-- 键盘弹出时调整 --> </manifest> 那帮我修改一下,除了将activity元素放在application中,不要做任何改动
06-19
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值