RecyclerView增加分割线divider

2019-02-15  本文已影响2人  虚无void

2019年2月15日 星期五

recyclerView.addItemDecoration(
new DividerItemDecoration(this,DividerItemDecoration.VERTICAL)
);

设置分割线高度

<shape xmlns:android="http://schemas.android.com/apk/res/android" 
android:shape="rectangle"> //矩形
    <size android:height="10dp" />
</shape>
DividerItemDecoration decor = new DividerItemDecoration(
this, layoutManager.getOrientation()
);
decor.setDrawable(ContextCompat.getDrawable(this,R.drawable.shape_divider2)); 
  1. 万能分割线
    RecyclerView的万能分割线 - pengkv的专栏 - CSDN博客
    https://blog.csdn.net/pengkv/article/details/50538121
上一篇 下一篇

猜你喜欢

热点阅读