日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Android >内容正文

Android

AndroidManifest.xml中Activity ConfigChanges属性的用法

發布時間:2024/4/15 Android 43 豆豆
生活随笔 收集整理的這篇文章主要介紹了 AndroidManifest.xml中Activity ConfigChanges属性的用法 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

?通過設置這個屬性可以使Activity捕捉設備狀態變化,以下是可以被識別的內容: ?

CONFIG_FONT_SCALE

CONFIG_MCC

CONFIG_MNC

CONFIG_LOCALE

CONFIG_TOUCHSCREEN

CONFIG_KEYBOARD

CONFIG_NAVIGATION

CONFIG_ORIENTATION


設置方法:將下列字段用“|”符號分隔開,例如:“ locale|navigation|orientation

ValueDescription
mccThe IMSI mobile country code (MCC) has changed — that is, a SIM hasbeen detected and updated the MCC.移動國家號碼,由三位數字組成,每個國家都有自己獨立的MCC,可以識別手機用戶所屬國家。
mncThe IMSI mobile network code (MNC) has changed — that is, a SIM hasbeen detected and updated the MNC.移動網號,在一個國家或者地區中,用于區分手機用戶的服務商。
localeThe locale has changed — for example, the user has selected a new language that text should be displayed in.用戶所在地區發生變化。
touchscreenThe touchscreen has changed. (This should never normally happen.)
keyboardThe keyboard type has changed — for example, the user has plugged in an external keyboard.鍵盤模式發生變化,例如:用戶接入外部鍵盤輸入
keyboardHiddenThe keyboard accessibility has changed — for example, the user has slid the keyboard out to expose it.用戶打開手機硬件鍵盤
navigationThe navigation type has changed. (This should never normally happen.)
orientationThe screen orientation has changed — that is, the user has rotated the device.設備旋轉,橫向顯示和豎向顯示模式切換。
fontScaleThe font scaling factor has changed — that is, the user has selected a new global font size.全局字體大小縮放發生改變
通過一個例子介紹這個屬性的用法:? 首先需要修改項目的manifest:
? View Code XML
<manifest?xmlns:android="http://schemas.android.com/apk/res/android"
? ?? ?package="com.androidres.ConfigChangedTesting"
? ?? ?android:versionCode="1"
? ?? ?android:versionName="1.0.0">
? ??<application?android:icon="@drawable/icon"?android:label="@string/app_name">
? ?? ???<activity?android:name=".ConfigChangedTesting"
? ?? ?? ?? ?? ?? ?android:label="@string/app_name"
? ?? ?? ?? ?? ?? ?android:configChanges="keyboardHidden|orientation">
? ?? ?? ?? ?<intent-filter>
? ?? ?? ?? ?? ??<action?android:name="android.intent.action.MAIN"?/>
? ?? ?? ?? ?? ??<category?android:name="android.intent.category.LAUNCHER"?/>
? ?? ?? ?? ?</intent-filter>
? ?? ???</activity>
? ??</application>
</manifest>

在Activity中添加了 android:configChanges屬性,目的是當所指定屬性(Configuration Changes)發生改變時,通知程序調用 onConfigurationChanged()函數


轉自:http://blog.csdn.net/super005/article/details/6307338

與50位技術專家面對面20年技術見證,附贈技術全景圖

總結

以上是生活随笔為你收集整理的AndroidManifest.xml中Activity ConfigChanges属性的用法的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。