A preference style can be set like this:
<Preference
android:key="my_pref"
style="?android:preferenceInformationStyle" />
Is there a way to apply the same style dynamically from Java?
You cannot set a view's style programmatically. Probably below solution will help: android set style in code