gpt4 book ai didi

android - 如何在滚动时显示 View 并在android中滚动停止后隐藏 View

转载 作者:行者123 更新时间:2023-11-30 02:58:22 24 4
gpt4 key购买 nike

我有一个线性布局 View ,布局底部有一些按钮。布局包含很多元素,所以我添加了 ScrollView 来显示所有内容。

现在,当我向上或向下滚动时,我想隐藏我底部的线性布局内容,一旦用户停止滚动 ListView ,我想再次显示它。

任何人都可以建议我一些解决方案来实现这一目标。任何帮助都是适当的谢谢

最佳答案

您可以尝试实现ScrollViewOnScrollListener。它有一个方法:

        /**
* Callback method to be invoked while the list view or grid view is being scrolled. If the
* view is being scrolled, this method will be called before the next frame of the scroll is
* rendered. In particular, it will be called before any calls to
* {@link Adapter#getView(int, View, ViewGroup)}.
*
* @param view The view whose scroll state is being reported
*
* @param scrollState The current scroll state. One of {@link #SCROLL_STATE_IDLE},
* {@link #SCROLL_STATE_TOUCH_SCROLL} or {@link #SCROLL_STATE_IDLE}.
*/
public void onScrollStateChanged(AbsListView view, int scrollState);

当滚动状态改变时,您可以setVisibility() 到您想要显示/隐藏的Button

关于android - 如何在滚动时显示 View 并在android中滚动停止后隐藏 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22939678/

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