我有一个问题,如果 RecyclerView 有很多项目(超过 180 个),当我单击第一行的 D-PAD Down 时,用户会自动向下滚动到列表底部。我为此列表使用了 GridLayout。
这是我的自定义回收站视图onDispatchEvent()
:
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
return super.dispatchKeyEvent(event);
}
这是视图:
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout
android:id="@+id/entry_container"
android:descendantFocusability="beforeDescendants"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<CustomRecycleView
android:id="@+id/list_view_horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/row_title"
android:layout_marginLeft="@dimen/margin_filter"
android:layout_marginRight="@dimen/margin_filter" />
</RelativeLayout>
</layout>
加载大约 120-130 个项目时不会出现此问题。有没有人遇到过这种类型的自动滚动?