![](/img/trans.png)
[英]How can I fix the position of buttons in a RecylerView layout? I don't want the buttons to scroll along with the image in RecyclerView
[英]How can I control position of scroll in recyclerview
我需要當滾動到頂部 position 或 recyclerview 中顯示的第一個項目時執行顯示工具欄之類的操作,當向下滾動或隱藏 recyclerview 中的第一個項目時隱藏工具欄或做某事
您可以嘗試在此處輸入圖像描述
嘗試這個:
contenuRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
if (yourLayoutManager.findFirstVisibleItemPosition() != 1){
// visible toolbar
} else {
// gone toolbar
}
}
});
yourLayoutManager 可以是:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.