In case you are going for the same appearance / behavior, you should stay with the plain PreferenceActivity
implementation, and add the new preference items
into the "list" dynamically from code (eventually with custom renderers).
A basic implementation of such display would be:
/**
* This variable stands for the items with which you want to populate the list
*/
final HashMap<String, String> networks = new HashMap<String, String>();
final PreferenceCategory cat = new PreferenceCategory(getApplicationContext());
cat.setTitle(R.string.wifinetworks); // holding "Wi-fi networks"
for (final String networkTitle : networks.keySet())
{
final Preference pref = new Preference(getApplicationContext());
pref.setTitle(networkTitle);
pref.setSummary(networks.get(networkTitle));
cat.addPreference(pref);
}
Edit: For adding custom components to an existing PreferenceActivity
, you should give a try to the addContentView
method. From within onCreate
:
final LayoutParams params = new LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT);
addContentView(buttonBar, params);