PreferenceActivity works correctly on Android 2.1, but not 4.1 (complemented)

I am writing an application. To work, it must work on the old Android OS. I wrote a settings screen using PreferencesActivity, which is populated with the options.xml file that contains the PreferenceScreen. It does not have a submenu for preferences (therefore, PreferenceFragment does not provide any real benefits).

In Android 2.1 (2.2 and 2.3, not yet tested on ICS), the screen displays correctly in the landscape: Eclair

But on Jellybean it looks like this: Jellybean

It looks awful. I have nothing defined as a layout, just standard addPreferencesFromResource (). Does anyone know what is the reason for this? Or a solution?

My onCreate looks like this:

    protected void onCreate(Bundle savedInstanceState) { //
    super.onCreate(savedInstanceState);
    Log.i(TAG, "Options Activity Loaded.");
    setTitle(getString(R.string.optionsTitle));
    addPreferencesFromResource(R.xml.options);
    setupListeners();
}

, , . PreferenceFragment PreferenceActivity. , Google , API- Fragment, markethare API, lib-.

+5
1

, SharedPreferences. . . :

Class spc = Build.VERSION_SDK_INT < Build.VERSION_CODES.HONEYCOMB ? 
    oldPreferenceActivity.class : newFragmentPreferenceActivity.class;

Intent i = new Intent (this, spc);
startActivityForResult (i, SHOW_PREFERENCES); 
+1

All Articles