【问题标题】:How to show view while scrolling and hide view after scrolling stop in android如何在滚动时显示视图并在android中滚动停止后隐藏视图
【发布时间】:2014-04-08 14:12:55
【问题描述】:

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

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

谁能建议我一些解决方案来实现这一点。 任何帮助都被挪用 谢谢

【问题讨论】:

    标签: android view scrollview show-hide


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-13
      • 1970-01-01
      相关资源
      最近更新 更多