Open itgoyo opened 3 years ago
rv.setLayoutManager(new LinearLayoutManager(mContext)); //添加自定义分割线 DividerItemDecoration divider = new DividerItemDecoration(this, DividerItemDecoration.VERTICAL); divider.setDrawable(ContextCompat.getDrawable(this,R.drawable.custom_chege_divider)); rv.addItemDecoration(divider); rv.setAdapter(adapter);
custom_chege_divider
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <size android:height="20pt" /> </shape>
最简单的方式:
rvFail.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
custom_chege_divider