I am currently using the example from Google's slidingtablayout
in my code.
I would like to replace one of the tabs' layout as a preference screen instead of the current linear/relative layout.
How can I do this?
Just add item PreferenceFragment
to your ViewPager
adapter.
public static class PrefsFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Load the preferences from an XML resource
addPreferencesFromResource(R.xml.preferences);
}
}
ViewPagerAdapter:
@Override
public Fragment getItem(int position) {
switch (position) {
case 0:
return new PrefsFragment();
default:
return null;
}
}