【发布时间】:2019-04-29 19:54:52
【问题描述】:
我正在尝试在 Recyclerview 这样的项目之间设置自定义分隔线:
XML:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:width="1dp"
android:color="#000"
android:dashWidth="20px"
android:dashGap="50px" />
</shape>
Java:
DividerItemDecoration itemDecorator = new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL);
itemDecorator.setDrawable(ContextCompat.getDrawable(getContext(), R.drawable.dashedline));
上面的代码不起作用,而不是虚线我明白了:
【问题讨论】:
标签: java android xml android-recyclerview