繁体   English   中英

如何在滚动时显示视图并在Android中停止滚动后隐藏视图

[英]How to show view while scrolling and hide view after scrolling stop in android

我有一个线性布局视图,在布局的底部带有一些按钮。布局包含许多元素,因此我添加了scrollview以显示所有内容。

现在,当我向上或向下滚动时,我想隐藏我的底部线性布局内容,并且当用户停止滚动列表视图时,我想再次显示它。

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

您可以尝试实现ScrollView OnScrollListener 它有一个方法:

        /**
         * 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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM