天天看點

activity屬性設定大全

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 被引入  

繼續閱讀