Activity屬性設置大全(轉)

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=[one or more of: "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="drawable resource"
android:label="string resource"

android:launchMode=["multiple" | "singleTop" |"singleTask" | "singleInstance"]
activity啓動方式, "standard" "singleTop" "singleTask" "singleInstance" 其中前兩個爲一組, 後兩個爲一組

android:multiprocess=["true" | "false"] android:name="string" android:noHistory=["true" | "false"]
是否需要移除這個activity當用戶切換到其他屏幕時。 這個屬性是 API level 3 中引入的
android:permission="string"

android:process="string"
一個activity運行時所在的進程名,所有程序組件運行在應用程序默認的進程中,這個進程名跟應用程序的包名一致。<application>中的元素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="resource or theme"
activity的樣式主題, 如果沒有設置,則activity的主題樣式從屬於應用程序, 參見<application>元素的theme屬性

android:windowSoftInputMode=[one or more of: "stateUnspecified""stateUnchanged" "stateHidden" "stateAlwaysHidden" "stateVisible""stateAlwaysVisible""adjustUnspecified""adjustResize" "adjustPan"] >
activity主窗口與軟鍵盤的交互模式, 自從API level 3 被引入
發佈了40 篇原創文章 · 獲贊 2 · 訪問量 3315
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章