You can use JakeWharton's Sherlock view pager indicator. Refer this.
https://github.com/JakeWharton/Android-ViewPagerIndicator that will support in all
version. Hope it might help you.
Question
class MyGestureDetector extends SimpleOnGestureListener {
@Override
public boolean onFling(MotionEvent event1, MotionEvent event2, float velocityX, float velocityY)
{
dX =event2.getX()-event1.getX();
dY =event1.getY()-event2.getY();
if (Math.abs(dY)<SWIPE_MAX_OFF_PATH &&Math.abs(velocityX)>=SWIPE_THRESHOLD_VELOCITY &&Math.abs(dX)>=SWIPE_MIN_DISTANCE )
{
swipe=new ViewFlipper(MainActivity.this);
if (dX>0)
{
result=false;
Toast.makeText(MainActivity.this,"Right swipe",Toast.LENGTH_LONG).show();
}
else
{
result=true;
Toast.makeText(MainActivity.this,"Left swipe",Toast.LENGTH_LONG).show();
}
}
else
{
result=false;
}
return result;
}
}
It works fine for me. But when I swipe left to right, it goes from first view to sixth view (1st page to 6th page). How can I do this?
How to reduce the speed? Why does it goes from first view to sixth view? Totally I have 10 views in my app. I am working on Android 2.2 version.
Solution
You can use JakeWharton's Sherlock view pager indicator. Refer this.
https://github.com/JakeWharton/Android-ViewPagerIndicator that will support in all
version. Hope it might help you.
OTHER TIPS
You can use use ViewPager with ActionBarSherlock and Android Support Library for earlier versions .. Good luck
What is the equivalent of ActionBar in earlier sdk versions?