17
我想为DividerItemDecoration设置我的自定义绘制(线),但没有成功。错误在哪里?为DividerItemDecoration设置绘制
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(getContext(),
LinearLayoutManager.VERTICAL);
dividerItemDecoration.setDrawable(getContext().getResources().getDrawable(R.drawable.sk_line_divider));
XML形状:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:width="1dp"
android:color="#000000">
</stroke>
</shape>
顺便说一句,你不需要'DividerItemDecoration#setDrawable',您可以设置'机器人:在你的主题listDivider'属性来代替。 – arekolek