gpt4 book ai didi

android - RecyclerView 上方的隐藏 View

转载 作者:搜寻专家 更新时间:2023-11-01 07:41:49 27 4
gpt4 key购买 nike

我想在 recyclerview 上面做一些隐藏的过滤器选项(例如在旧版本的 spotify 中):

enter image description here

该怎么做?我在回收站上方使用 AppBar。

最佳答案

你可以使用这段代码做你想做的事

        mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);

}

@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
if (dy > 0) {
//You should HIDE filter view here
} else if (dy < 0) {
System.out.println("Scrolled Upwards");
if (mLayoutManager.findFirstCompletelyVisibleItemPosition() == 0) {
//this is the top of the RecyclerView
System.out.println("==================================== >>>> Detect top of the item List");
//You should visible filter view here
} else {
//You should HIDE filter view here
}
} else {
System.out.println("No Vertical Scrolled");
//You should HIDE filter view here
}
}
});

关于android - RecyclerView 上方的隐藏 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56236282/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com