Help! I tried all answers on SO but to no avail
Shape xml:
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="line">
    <!-- stroke width must be 1px, see https://stackoverflow.com/questions/3979218/android-listview-divider -->  
    <stroke 
        android:width="1px"
        android:color="#aaAAaa" />  
</shape>
In ListFragment:
public void onViewCreated(View v, Bundle bundle){
  listView = getListView();
  listView.setDivider(getActivity().getResources().getDrawable(R.drawable.xxxx));
  listView.setDividerHeight(1);
  setListAdapter(...);
}
Adapter:
@Override public boolean areAllItemsEnabled(){return true;}
Also, the divider should not span the entire listview's width, I want to have some padding on the left and right. So I think a shape drawable is a must.
EDITED Answer: Don't use line, use a rectangle instead. and follow this for padding: How to add padding to gradient <shape> in Android?