我在我的布局中有"0dp“宽度和"spead”宽度约束的RecyclerView。它工作得很好,但是如果我没有足够的元素来填充整个宽度,那么当单击“空区域”时,回收器视图的onClickListener不会被调用。
如何截取单击此视图的空白部分?当我将它设置为"match_parent“宽度的普通布局时,一切正常。
<android.support.v7.widget.RecyclerView
android:id="@+id/rvThumbnails"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintWidth_default="spread"
app:layout_constraintHeight_default="wrap"
app:layout_constraintTop_toBottomOf="@+id/tv_message"
app:layout_constraintStart_toStartOf="@+id/tv_message"
app:layout_constraintEnd_toEndOf="parent"
android:visibility="@{notification.sendit.files.size() > 0 && notification.type != NotificationType.GROUPED ? View.VISIBLE : View.GONE}" />发布于 2018-03-22 22:33:12
最后,通过将"layout_width“更改为"match_parent”并删除宽度限制来修复此问题。
如果有人有更好的解决方案,请提供。我将接受使用约束的答案。
https://stackoverflow.com/questions/49430891
复制相似问题