Android Activity属性

  1 <activity android:name=".MainActivity"
  2         android:alwaysRetainTaskState=["true" | "false"]
  3         android:clearTaskOnLaunch=["true" | "false"]
  4         android:configChanges=["mcc", "mnc", "locale",
  5                                "touchscreen", "keyboard", "keyboardHidden",
  6                                "navigation", "screenLayout", "fontScale", "uiMode",
  7                                "orientation", "screenSize", "smallestScreenSize"]
  8         android:enabled=["true" | "false"]
  9         android:excludeFromRecents=["true" | "false"]
 10         android:exported=["true" | "false"]
 11         android:finishOnTaskLaunch=["true" | "false"]
 12         android:hardwareAccelerated=["true" | "false"]
 13         android:icon="drawable resource"
 14         android:label="string resource"
 15         android:launchMode=["multiple" | "singleTop" |
 16                             "singleTask" | "singleInstance"]
 17         android:multiprocess=["true" | "false"]
 18         android:name="string"
 19         android:noHistory=["true" | "false"]
 20         android:permission="string"
 21         android:process="string"
 22         android:screenOrientation=["unspecified" | "user" | "behind" |
 23                                    "landscape" | "portrait" |
 24                                    "reverseLandscape" | "reversePortrait" |
 25                                    "sensorLandscape" | "sensorPortrait" |
 26                                    "sensor" | "fullSensor" | "nosensor"]
 27         android:stateNotNeeded=["true" | "false"]
 28         android:taskAffinity="string"
 29         android:theme="resource or theme"
 30         android:uiOptions=["none" | "splitActionBarWhenNarrow"]
 31         android:windowSoftInputMode=["stateUnspecified",
 32                                      "stateUnchanged", "stateHidden",
 33                                      "stateAlwaysHidden", "stateVisible",
 34                                      "stateAlwaysVisible", "adjustUnspecified",
 35                                      "adjustResize", "adjustPan"] />
 36 . . .
 37 
 38 
 39 // 是否允许activity更换从属的任务,比如从短信息任务 切换到浏览器任务。
 40 android:allowTaskReparenting=["true" | "false"]
 41 
 42 // 是否保留状态不变, 比如切换回home, 再从新打开, activity处于最后的状态
 43 android:alwaysRetainTaskState=["true" | "false"]
 44 
 45 // 比如 P 是 activity, Q 是被P 触发的 activity, 然后返回Home, 从新启动 P, 是否显示 Q
 46 android:clearTaskOnLaunch=["true"" | "false"]
 47                            
 48 // 当配置list发生修改时, 是否调用 onConfigurationChanged() 方法 比如 "locale|navigation|orientation".
 49 android:configChanges=[one or more of: "mcc" "mnc" "locale" "touchscreen" "keyboard" "keyboardHidden" "navigation" "orientation" "fontScale"]
 50 
 51 // activity 是否可以被实例化
 52 android:enabled=["true" | "false"]
 53                            
 54 // 是否可被显示在最近打开的activity列表里
 55 android:excludeFromRecents=["true" | "false"]
 56 
 57 // 是否允许activity被其它程序调用
 58 android:exported=["true" | "false"]
 59                            
 60 // 是否关闭已打开的activity当用户重新启动这个任务的时候
 61 android:finishOnTaskLaunch=["true" | "false"]
 62 
 63                            
 64 android:icon="drawable resource"
 65 android:label="string resource"
 66 
 67 // activity启动方式, "standard" "singleTop" "singleTask" "singleInstance" 其中前两个为一组, 后两个为一组
 68 android:launchMode=["multiple" | "singleTop" |"singleTask" | "singleInstance"]
 69 
 70 
 71 android:multiprocess=["true" | "false"]
 72 android:name="string"
 73 
 74 // 是否需要移除这个activity当用户切换到其他屏幕时。 这个属性是 API level 3 中引入的
 75 android:noHistory=["true" | "false"]
 76 
 77 android:permission="string"
 78 
 79 // 一个activity运行时所在的进程名,所有程序组件运行在应用程序默认的进程中,这个进程名跟应用程序的包名一致。
 80 // 中的元素process属性能够为所有组件设定一个新的默认值。但是任何组件都可以覆盖这个默认值,允许你
 81 // 将你的程序放在多进程中运行。 如果这个属性被分配的名字以:开头,当这个activity运行时,一个新的专属于这个程序的
 82 // 进程将会被创建。如果这个进程名以小写字母开头,这个activity将会运行在全局的进程中,被它的许可所提供。
 83 android:process="string"
 84 
 85 // activity显示的模式, "unspecified" 默认值 "landscape" 风景画模式,宽度比高度大一些 "portrait" 肖像模式, 高度比
 86 // 宽度大。 "user" 用户的设置 "behind" "sensor" "nosensor",其它几个属性3.0后被引入。
 87 android:screenOrientation=["unspecified" | "user" | "behind" |"landscape" | "portrait" | "sensor" | "nonsensor"]
 88 
 89 
 90 // 是否 activity被销毁和成功重启并不保存状态
 91 android:stateNotNeeded=["true" | "false"]
 92 
 93 // activity的亲属关系, 默认情况同一个应用程序下的activity有相同的关系
 94 android:taskAffinity="string"
 95 
 96 // activity的样式主题, 如果没有设置,则activity的主题样式从属于应用程序, 参见元素的theme属性
 97 android:theme="resource or theme"
 98 
 99 // activity主窗口与软键盘的交互模式, 自从API level 3 被引入。
100 android:windowSoftInputMode=[one or more of: "stateUnspecified""stateUnchanged" "stateHidden" "stateAlwaysHidden"
101                             "stateVisible""stateAlwaysVisible""adjustUnspecified""adjustResize" "adjustPan"]

 

posted @ 2017-05-07 14:53  naray  阅读(296)  评论(0编辑  收藏  举报