Issue
I was trying to hide a button during scroll view is in idle state.the button should be invisible only during scrolling time.(Rest of the time button should be visible)
scrollView.setOnScrollChangeListener(new ScrollView.OnScrollChangeListener() {
@Override
public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
if (scrollX == scrollY) {
Button.setVisibility(View.VISIBLE);
} else if ((scrollY > oldScrollY)) {
Button.setVisibility(View.INVISIBLE);
}
}
});
Solution
Find the solution
scrollView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch( View v, MotionEvent event ) {
switch ( event.getAction( ) ) {
case MotionEvent.ACTION_SCROLL:
case MotionEvent.ACTION_MOVE:
Log.e( "SCROLL", "ACTION_SCROLL" );
break;
case MotionEvent.ACTION_DOWN:
Log.e( "SCROLL", "ACTION_DOWN" );
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
Log.e( "SCROLL", "SCROLL_STOP" );
break;
}
return false;
}
});
Answered By - Rajasekhar Reddy
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.