android4.2.2 Settings

 

出自 :http://blog.csdn.net/abc137508277/article/details/8878885

Setting分析

Setting的啓動要從setting.java中分析。爲topactivity extends PreferenceActivity

PreferenceActivity英語文檔

This activityshows one or more headers of preferences, each of which is associated with a PreferenceFragment to display the preferences of that header. The actuallayout and display of these associations can however vary; currently there aretwo major approaches it may take:

·        On a small screen it may display only the headers as asingle list when first launched. Selecting one of the header items willre-launch the activity with it only showing the PreferenceFragment of thatheader.

·        On a large screen in may display both the headers andcurrent PreferenceFragment together as panes. Selecting a header item switchesto showing the correct PreferenceFragment for that item.

以上意思翻譯過來就是說,preferrenceActivity可以顯示1個或者多個header。每個header都是以PreferenceFragment顯示。

PreferenceActivity顯示也分兩種,

一種是在小的屏幕上,或者低分辨率設備上,只顯示header部分。點擊header進入fragment。

另外一種是在大的屏幕上或者高分辨率設備上,header和fragment同時顯示,左側是header,右側是fragment.

在onBuildHeaders加載主界面

loadHeadersFromResource(R.xml.settings_headers,headers);

其中addPreferencesFromResource methodwas deprecated in API level 11

各個fragment是依附於subsetting的,由subsetting統一管理各個fragment。相當於一個activity在多個UI界面之間的切換。

其設置裏面的Google Account有個location setting,這個東西是在GoogleServicesFramework.apk中添加的。沒有源碼,這個是google服務框架。

轉載請註明出處,thanks!

發佈了7 篇原創文章 · 獲贊 7 · 訪問量 4萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章