1.***Fragment 继承 PreferenceFragment
2.重写
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) 方法(不需要调用父类方法)
3.inflater.inflate(R.layout.****_screen, container, false);
其中****_screen需要包含:
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:clipToPadding="false"
android:scrollbarStyle="outsideOverlay" />
注: id必须为"@android:id/list"
此ListView放preferenceScreen的地方
4.可以修改listview的padding
5.在xml下写一个PreferenceScreen的布局
6.调用addPreferencesFromResource(R.xml.***)
Preference布局在ListView中