Before I asked to remove the padding of the PreferenceActivity/PreferenceFragment:
Android: How to maximize PreferenceFragment width (or get rid of margin)?
If you are creating preferences dynamically pass ContextThemeWrapper as a parameter to the new Preference
TypedValue themeTypedValue = new TypedValue();
getActivity().getTheme().resolveAttribute(R.attr.preferenceTheme, themeTypedValue, true);
ContextThemeWrapper contextThemeWrapper = new ContextThemeWrapper(getActivity(), themeTypedValue.resourceId);
Preference preference = new Preference(contextThemeWrapper);
I have found it in this article: Dynamically creating Preference Screens on Android