首页 > 解决方案 > 项目单击不起作用,而在 recyclerview 中自动滚动

问题描述

我使用以下代码自动滚动水平回收器视图。

private final Runnable SCROLLING_RUNNABLE = new Runnable() {

        @Override
        public void run() {
            recyclerViewDate.smoothScrollBy(pixelsToMove, 0);
            setDateValue();
            mHandler.postDelayed(this, duration);
        }
    };


@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_center_item_finder);
        txtSelected=(TextView)findViewById(R.id.txtSelected);
        getRecyclerviewData();
        mHandler.postDelayed(SCROLLING_RUNNABLE, 100);
    }

但我无法在滚动时单击回收站项目。找到了这个解决方案,创建了一个自定义的 recyclerview。Android - 滚动后无法单击 RecyclerView 中的项目 仍然单击不起作用。

标签: android-recyclerviewonitemclick

解决方案


推荐阅读