I have PreferenceScreen contain many CheckBox , i customize it by refer it to custom layout as bellow :
&
You must create your own drawable resource for divider:
In this case divider shape height is 4dp and top padding is 5dp, when you set divider height you must sum shape height + inset's.
ListView list = (ListView) findViewById(android.R.id.list);
list.setDivider(new ColorDrawable(Color.RED)); // or some other color int
list.setDividerHeight((5)); //wrorng code
list.setVerticalScrollBarEnabled(false);
To set divider height correctly for all dencity screens you must set it in dp's but for default number "5" interpreted in pixels(px).
final float scale = getContext().getResources().getDisplayMetrics().density;
int pixels = (int) (dps * scale + 0.5f);
For more information about shape and inset drawable resource use Android Documentation Drawable resources