📜  recyclerView 高度在滚动时降低 - Kotlin 代码示例

📅  最后修改于: 2022-03-11 14:53:32.304000             🧑  作者: Mango

代码示例1
LinearLayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
layoutManager.setMeasurementCacheEnabled(false);

YourRecyclerView.setLayoutManager(layoutManager);
YourRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);
            layoutManager.requestLayout();
        }
    });