📖

Android実装チラ裏メモ

2021/06/08に公開

忘れがちだけどたまに使うAndroid実装のチラ裏メモ

RecyclerViewでさらに読み込む時のイベント

チャットとかで

        binding.myRecyclerView.addOnScrollListener(object: RecyclerView.OnScrollListener() {
            override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
                super.onScrolled(recyclerView, dx, dy)
                val canScrollUp = binding.myRecyclerView.canScrollVertically(-1)
                if (!canScrollUp) {
                    // more load
                }
            }
        })

Discussion