这是一个如何ListView使用divider和dividerHeight参数在类中执行的示例:
<ListView
android:id="@+id/activity_home_list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@android:color/transparent"
android:dividerHeight="8dp"/>
Run Code Online (Sandbox Code Playgroud)
但是,我没有在RecyclerView课堂上看到这种可能性.
<android.support.v7.widget.RecyclerView
android:id="@+id/activity_home_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"/>
Run Code Online (Sandbox Code Playgroud)
在这种情况下,可以直接定义边距和/或将自定义分隔视图添加到列表项的布局中,还是有更好的方法来实现我的目标?
我正在玩新的RecyclerView.并遇到了一些问题:
android:background="?android:attr/selectableItemBackground"(以L RecyclerView onItemClick效果)如何在单击时使RecyclerView的行为更像ListView,以便用户能够在通知单击侦听器之前看到完成单击动画?
我知道我可以通过使用来解决这个问题,View.postDelayed但这似乎不是最佳解决方案,因为在延迟期间,用户可能能够点击更多列表项.
下面是具有一个机器人工作室项目的存储库中的链接ListView和RecyclerView并排帮助演示问题:https://github.com/ericytsang/question.listview-vs-recyclerview
非常感谢!