Android之 Preference的學習

1、android.preference.Preference

Represents the basic Preference UI building block displayed by a PreferenceActivity in the form of a ListView. This class provides the View to be displayed in the activity and associates with a SharedPreferences to store/retrieve the preference data.

When specifying a preference hierarchy in XML, each element can point to a subclass of Preference, similar to the view hierarchy and layouts.

This class contains a key that will be used as the key into the SharedPreferences. It is up to the subclass to decide how to store the value.

 

通過PreferenceActivity以ListView的形式顯示,這個類提供了在activity中顯示View的方法,同時使用SharedPrederence對象來存儲/檢索preference data.

在實際的xml佈局文件中,可以使用Preference的具體子類。

這個類包含了在SharedPreference中作爲鍵值的key。一般由子類來決定如何存儲值。

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章