通过 PreferenceFragmentCompat 构建 preference settings 的方法

Preferences Support Library: Preference Fragments for API 7+, no matter the Activity

A simple implementation would include a PreferenceFragmentCompat such as:

    public class PreferencesFragment extends PreferenceFragmentCompat {
        @Override
        public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
            addPreferencesFromResource(R.xml.preferences);
        }
    }

You’ll also need to set preferenceTheme in your theme:

    <style name="AppTheme" parent="@style/Theme.AppCompat.Light">
      <item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
    </style>

And add this in dependencies:

compile 'com.android.support:preference-v14:23.1.0'