i need when scroll to top position or first item show in the recyclerview do something like show toolbar and when scroll down or hide first item in recyclerview hide toolbar or do somethinghing
You can try enter image description here
Try this:
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 can be:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.