Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 980 Bytes

PreferenceFragment.md

File metadata and controls

32 lines (22 loc) · 980 Bytes

PrefremceFragment

2016.08.17

use PrefremceFragment when you only got one page of settings to show and you're currently supporting Andorid 3.0+.

See also:

https://developer.android.com/guide/topics/ui/settings.html#Fragment


  1. Create a Fragment extends PrefremceFragment
public static class SettingsFragment extends PreferenceFragment {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Load the preferences from an XML resource
        addPreferencesFromResource(R.xml.preferences);
    }
    ...
}
  1. Start this Fragment from any Activity or build a SettingActivty for this.

  2. If you want to digging more about Settings, see following links: