---
title: "Activity 属性"
author: "zengyan2012"
date: "2013-07-26T09:25:08Z"
tags: []
categories: ["移动开发"]
slug: "activity"
draft: false
lastmod: "2013-07-26T09:25:08Z"
id: 1913807
url: "https://zengyan2012.iteye.com/blog/1913807"
---

[![](http://www.eoeandroid.com//data/attachment/common/cf/133032qgi4fyxy96ay0aa4.png)](http://salon.eoe.cn/dev/show/aid/46.html)

activity属性设置大全

 

转自：[http://www.eoeandroid.com/thread-296619-1-1.html](http://www.eoeandroid.com/thread-296619-1-1.html)  
　　  
　　android:allowTaskReparenting=\["true"|"false"]  
　　  
　　是否允许activity更换从属的任务，比如从短信息任务切换到浏览器任务。  
　　  
　　android:alwaysRetainTaskState=\["true"|"false"]  
　　  
　　是否保留状态不变，比如切换回home,再从新打开，activity处于最后的状态  
　　  
　　android:clearTaskOnLaunch=\["true""|"false"]  
　　  
　　比如P是activity,Q是被P触发的activity,然后返回Home,从新启动P，是否显示Q  
　　  
　　android:configChanges=\[oneormoreof:"mcc""mnc""locale""touchscreen""keyboard""keyboardHidden""navigation""orientation""fontScale"]  
　　  
　　当配置list发生修改时，是否调用onConfigurationChanged()方法比如"locale|navigation|orientation".  
　　  
　　android:enabled=\["true"|"false"]  
　　  
　　activity是否可以被实例化,  
　　  
　　android:excludeFromRecents=\["true"|"false"]  
　　  
　　是否可被显示在最近打开的activity列表里  
　　  
　　android:exported=\["true"|"false"]  
　　  
　　是否允许activity被其它程序调用  
　　  
　　android:finishOnTaskLaunch=\["true"|"false"]  
　　  
　　是否关闭已打开的activity当用户重新启动这个任务的时候  
　　  
　　android:icon="drawableresource"  
　　  
　　android:label="stringresource"  
　　  
　　android:launchMode=\["multiple"|"singleTop"|"singleTask"|"singleInstance"]  
　　  
　　activity启动方式，"standard""singleTop""singleTask""singleInstance"其中前两个为一组，后两个为一组  
　　  
　　android:multiprocess=\["true"|"false"]  
　　  
　　android:name="string"  
　　  
　　android:noHistory=\["true"|"false"]  
　　  
　　是否需要移除这个activity当用户切换到其他屏幕时。这个属性是APIlevel3中引入的  
　　  
　　android:permission="string"  
　　  
　　android:process="string"  
　　  
　　一个activity运行时所在的进程名，所有程序组件运行在应用程序默认的进程中，这个进程名跟应用程序的包名一致。  
　　  
　　中的元素process属性能够为所有组件设定一个新的默认值。但是任何组件都可以覆盖这个默认值，允许你  
　　  
　　将你的程序放在多进程中运行。如果这个属性被分配的名字以:开头，当这个activity运行时,一个新的专属于这个程序的  
　　  
　　进程将会被创建。如果这个进程名以小写字母开头，这个activity将会运行在全局的进程中，被它的许可所提供。  
　　  
　　android:screenOrientation=\["unspecified"|"user"|"behind"|"landscape"|"portrait"|"sensor"|"nonsensor"]  
　　  
　　activity显示的模式,"unspecified"默认值"landscape"风景画模式，宽度比高度大一些"portrait"肖像模式,高度比  
　　  
　　宽度大。"user"用户的设置"behind""sensor""nosensor"  
　　  
　　android:stateNotNeeded=\["true"|"false"]  
　　  
　　是否activity被销毁和成功重启并不保存状态  
　　  
　　android:taskAffinity="string"  
　　  
　　activity的亲属关系，默认情况同一个应用程序下的activity有相同的关系  
　　  
　　android:theme="resourceortheme"  
　　  
　　activity的样式主题,如果没有设置，则activity的主题样式从属于应用程序，参见元素的theme属性  
　　  
　　android:windowSoftInputMode=[oneormoreof:"stateUnspecified""stateUnchanged""stateHidden""stateAlwaysHidden"  
　　  
　　"stateVisible""stateAlwaysVisible""adjustUnspecified""adjustResize""adjustPan"]&gt;  
　　  
　　activity主窗口与软键盘的交互模式,自从APIlevel3被引入