DividerItemDecoration不显示android

DividerItemDecoration不显示android,第1张

概述我有一个简单的布局用于回收者视图项目.<?xmlversion="1.0"encoding="utf-8"?><RelativeLayoutxmlns:android="http://schemas.android.com/apkes/android"android:id="@+id/details"android:layout_width="match_parent"

我有一个简单的布局用于回收者视图项目.

<?xml version="1.0" enCoding="utf-8"?><relativeLayoutxmlns:androID="http://schemas.androID.com/apk/res/androID"androID:ID="@+ID/details"androID:layout_wIDth="match_parent"androID:layout_height="?androID:attr/ListPreferredItemHeight"androID:background="?androID:attr/selectableItemBackground"androID:paddingEnd="15dp"androID:paddingStart="15dp"><org.tchouaffe.ftinfosystem.utils.CustomTextVIEw    androID:ID="@+ID/name"    androID:layout_wIDth="wrap_content"    androID:layout_height="match_parent"    androID:gravity="center_vertical"    androID:textcolor="@color/primaryTextcolor"    androID:textSize="15sp"/><org.tchouaffe.ftinfosystem.utils.CustomTextVIEw    androID:ID="@+ID/level"    androID:layout_wIDth="wrap_content"    androID:layout_height="match_parent"    androID:layout_alignParentRight="true"    androID:layout_toRightOf="@ID/name"    androID:gravity="center_vertical|right"    androID:textcolor="@color/primaryTextcolor"    androID:textSize="15sp"/></relativeLayout>

以下代码确实设置了回收站视图:

 RecyclerVIEw recyclerVIEw = (RecyclerVIEw) vIEw.findVIEwByID(R.ID.recyclervIEw);    linearlayoutmanager layoutManager = new linearlayoutmanager(getActivity());    MyAdapter adapter = new MyAdapter(activity, elementList);    adapter.setHasStableIDs(true);    divIDerItemdecoration divIDerItemdecoration = new divIDerItemdecoration(recyclerVIEw            .getContext(), divIDerItemdecoration.VERTICAL);    recyclerVIEw.addItemdecoration(divIDerItemdecoration);    recyclerVIEw.setHasFixedSize(false);    recyclerVIEw.setLayoutManager(layoutManager);    recyclerVIEw.setAdapter(adapter);

由于未知原因,分隔线未显示.
有任何想法吗?

我正在使用androID.support.v7.Widget.divIDerItemdecoration.

谢谢

解决方法:

您还需要在divIDerdecoration上调用setDrawable().

提供可绘制的资源. XML shape drawable可能是一个好的开始.形状将作为回收者项目视图之间的分隔线呈现.

或者,在声明应用主题时,您可以
 将androID:ListdivIDer项目设置为所需的drawable.

总结

以上是内存溢出为你收集整理的DividerItemDecoration不显示android全部内容,希望文章能够帮你解决DividerItemDecoration不显示android所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1120960.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-29
下一篇2022-05-29

发表评论

登录后才能评论

评论列表(0条)

    保存