diff --git a/app/src/main/java/com/hippo/ehviewer/widget/SearchLayout.java b/app/src/main/java/com/hippo/ehviewer/widget/SearchLayout.java index 6e481e56d..845b5b40d 100644 --- a/app/src/main/java/com/hippo/ehviewer/widget/SearchLayout.java +++ b/app/src/main/java/com/hippo/ehviewer/widget/SearchLayout.java @@ -103,7 +103,7 @@ public class SearchLayout extends EasyRecyclerView implements CompoundButton.OnC Resources resources = context.getResources(); mInflater = LayoutInflater.from(context); - mLayoutManager = new LinearLayoutManager(context); + mLayoutManager = new SearchLayoutManager(context); mAdapter = new SearchAdapter(); setLayoutManager(mLayoutManager); setAdapter(mAdapter); @@ -383,4 +383,20 @@ public class SearchLayout extends EasyRecyclerView implements CompoundButton.OnC } } } + + static class SearchLayoutManager extends LinearLayoutManager { + + public SearchLayoutManager(Context context) { + super(context); + } + + @Override + public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) { + try { + super.onLayoutChildren(recycler, state); + } catch (IndexOutOfBoundsException e) { + e.printStackTrace(); + } + } + } }