Android Activity屬性介紹

來源:互聯網
上載者:User

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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.