如何使用和 DividerItemDecoration 添加分隔符

DividerItemDecoration 是可以用作物品之间的分隔一个 RecyclerView.ItemDecoration

DividerItemDecoration mDividerItemDecoration = new DividerItemDecoration(context,
             mLayoutManager.getOrientation());
recyclerView.addItemDecoration(mDividerItemDecoration);

它支持使用 DividerItemDecoration.VERTICALDividerItemDecoration.HORIZONTAL 进行定向。