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。一般由子類來決定如何存儲值。