AndroidMainfest文件中常用android属性

本文深入探讨了AndroidManifest.xml文件中常用的android属性及其作用,包括allowTaskReparenting、alwaysRetainTaskState等,详细解释了每个属性的功能,帮助开发者更好地理解并应用这些属性以优化应用性能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<!-- [if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:PunctuationKerning/> <w:DrawingGridVerticalSpacing>7.8 磅</w:DrawingGridVerticalSpacing> <w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery> <w:DisplayVerticalDrawingGridEvery>2</w:DisplayVerticalDrawingGridEvery> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:Compatibility> <w:SpaceForUL/> <w:BalanceSingleByteDoubleByteWidth/> <w:DoNotLeaveBackslashAlone/> <w:ULTrailSpace/> <w:DoNotExpandShiftReturn/> <w:AdjustLineHeightInTable/> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> <w:DontGrowAutofit/> <w:UseFELayout/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!-- [if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--><!-- /* Font Definitions */ @font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:"/@宋体"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; mso-pagination:none; font-size:10.5pt; mso-bidi-font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:宋体; mso-font-kerning:1.0pt;} /* Page Definitions */ @page {mso-page-border-surround-header:no; mso-page-border-surround-footer:no;} @page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1;} --><!-- [if gte mso 10]> <mce:style><!-- /* Style Definitions */ table.MsoNormalTable {mso-style-name:普通表格; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} --> <!-- [endif]-->

Android Mainfest 文件中常用 android 属性

1.android:allowTaskReparenting ,是否允许 activity 更换从属的任务,比如从短信息任务 切换到浏览器任务。
2.android:alwaysRetainTaskState
,是否保留状态不变, 比如切换回 home, 再从新打开, activity 处于最后的状态

3.android:clearTaskOnLanunch , 比如 P activity, Q 是被 P 触发的 activity, 然后返回 Home, 从新启动 P 是否显示 Q

4.android:configChanges , 当配置 list 发生修改时, 是否调用 onConfigurationChanged() 方法 比如 "locale|navigation|orientation".

5.android:enabled,activity , 是否可以被实例化 ,

6.android:excludeFromRecents , 是否可被显示在最近打开的 activity 列表里
7.android:exported , 是否允许 activity 被其它程序调用

8.android:finishOnTaskLaunch , 是否关闭已打开的 activity 当用户重新启动这个任务的时候

9.android:launchMode , activity 启动方式, "standard" "singleTop" "singleTask" "singleInstance" 其中前两个为一组, 后两个为一组
<!-- [endif]-->

10.android:multiprocess , 允许多进程

11.android:name , activity 的类名, 必须指定

12.android:onHistory , 否需要移除这个 activity 当用户切换到其他屏幕时。 这个属性是 API level 3 中引入的

13.android:process , activity 运行时所在的进程名, 所有程序组件运行在应用程序默认的进程中,这个进程名跟应用程序的包名一致。 <application> 中的元素 process 属性能够为所 有组件设定一个新的默认值。但是任何组件都可以覆盖这个默认值,允许你将你的程序放在多进程中运行。 如果这个属性被分配的名字以 : 开头, 当这个 activity 运行时 , 一个新的专属于这个程序的进程将会被创建。 如果这个进程名以小写字母开头, 这个 activity 将会运行在全局的进程中,被它的许可所提供。
<!-- [endif]-->

14.android:screenOrientation , activity 显示的模式 , "unspecified" 默认值 "landscape" 风景画模式,宽度比高度大一些 "portrait" 肖像模式 , 高度比宽度大。 "user" 用户的设置 "behind" "sensor" "nosensor"

15.android:stateNotNeeded , 是否 activity 被销毁和成功重启并不保存状态

16.android:taskAffinity , activity 的亲属关系, 默认情况同一个应用程序下的 activity 有相同的关系

17.android:theme , activity 的样式主题 , 如果没有设置,则 activity 的主题样式从属于应用程序, 参见 <application> 元素的 theme 属性
<!-- [endif]-->

18.android:windowSoftInputMode , activity 主窗口与软键盘的交互模式 , 自从 API level 3 被引入

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值