when recycler view item is updated, one of the item is shown selected. How can I remove the auto selection after update?

I have been using the code snippets for scrolling position after update

void scrollToPositionWithOffset(LinearLayoutManager layoutManager,
                                    DetailItemData detailItemData,
                                    int pxOffset) {
        LogUtil.logI(TAG, "detailItemData=" + detailItemData.getClass().getName() + ", pxOffset=" + pxOffset);
        final int dataIndex = detailAdapter.get().findIndexByViewData(detailItemData);
        LogUtil.logI(TAG, "dataIndex: " + dataIndex);
        if (dataIndex < 0) {
            LogUtil.logE(TAG, "Can't find index. scroll to at(0).");
            layoutManager.scrollToPositionWithOffset(0, pxOffset);
            return;
        }

        layoutManager.scrollToPositionWithOffset(dataIndex, pxOffset);
    }


 layoutManager.scrollToPositionWithOffset(dataIndex, pxOffset);

Upvotes: 0

Views: 10

Answers (0)

Related Questions