I have a list view. On click of an item a detailed view for the item is open. This layout has many widgets like text view, ImageView Buttons
etc. Now I want to
I thought a new answer would be a good idea since the old one is so different.
I'll start with a bit of background: The idea here is to use a horizontal scroll view to move to the next set of controls in a pretty way. So when the user stop scrolling the scroll view to the left or right, we want to change the pictures and text, and then move the scroll back to the middle in preparation for the next swipe. Someone has already answered how to listen for when a scroll view stops I've included an almost working example of how you might use this to get the effect you are looking for.
I hope this helps out and feel free to ask if you have anymore problems.
@Override
protected void onScrollChanged(int x, int y, int oldX, int oldY) {
if (Math.abs(y - oldY) > SlowDownThreshold) {
currentlyScrolling = true;
} else {
currentlyScrolling = false;
if (!currentlyTouching) {
//scrolling stopped...handle here
//Check if it was a left or right swipe by comparing the new and old scroll locations
if (y > oldY) {
//Scroll moved Right
//So we would do something like
setContents(Index + 1);
//We find out where the middle of the scroll is
int middleHScroll = (Hscrollview.getMeasuredWidth() / 2) - (Hscrollview.getMeasuredWidth() / 2)
//We then return the scroll view to the middle
HScroll.scrollTo(middleHScroll);
} else {
//Scroll moved Left
//We get set the pictures and text to the previous Index of the contents
setContents(Index - 1);
//We find out where the middle of the scroll is
int middleHScroll = (Hscrollview.getMeasuredWidth() / 2) - (Hscrollview.getMeasuredWidth() / 2)
//We then return the scroll view to the middle
HScroll.scrollTo(middleHScroll);
}
super.onScrollChanged(x, y, oldX, oldY);
}
}
}
The xml should be something along these lines. There is still plenty of work to do to get this working but I hope this puts you in the right direction.