user3064556
user3064556

Reputation: 83

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

I have a linear layout view with some button at the bottom of my layout.. Layout contains lots of elements so I haveadded scrollview to show all contents.

Now when i scroll up or down i want to hide my bottom linear layout content and as soon as user stop scrolling listview I want to show it again.

Can any one suggest me some solution to achieve this. Any help is appropriated Thanks

Upvotes: 1

Views: 1610

Answers (1)

negersiu
negersiu

Reputation: 562

You can try to implement OnScrollListener of your ScrollView. It has a method:

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

When scroll state changes you can setVisibility() to a Button you want to show/hide.

Upvotes: 1

Related Questions