setOnScrollChangeListener shake the screen when using setVisibility(GONE) for SearchView in Android

Viewed 13

I am using the following code to hide SearchView when scrolling down on ScrollView when I scroll slow, screen start to shake after the if animationUtils.slideUp(search); is custom animation function which slow the scroll view with animation. The problem is then screen start to shake if I scroll slow and the animation doesn't help also any clue how can I fix it.

    homeScroll.setOnScrollChangeListener(new View.OnScrollChangeListener() {
        @Override
        public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
            search.setVisibility(View.GONE);
            if (homeScroll.getScrollY() <= 0) {
                animationUtils.slideUp(search);
            }
        }
    });
0 Answers
Related