我正在尝试为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>
将形状更改为矩形。
例如:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size
android:width="1dp"
android:height="1dp" />
<solid android:color="@color/primary" />
</shape>
效果惊人