Take the 2-minute tour ×

How to create an Page Control in android.... I want to move from one page to another page, like the home screen in android device... it displays the current page by the 3 to 4 dots....

share|improve this question

3 Answers 3

up vote 0 down vote accepted

I've managed to do exactly the same by doing something like:

int currentScreen = 1;

final GestureDetector gestureDetector = new GestureDetector(
                new MyGestureDetector());

                new View.OnTouchListener() {
                    public boolean onTouch(View v, MotionEvent event) {

                        if (gestureDetector.onTouchEvent(event)) {
                            return true;
                        } else if (event.getAction() == MotionEvent.ACTION_UP
                                || event.getAction() == MotionEvent.ACTION_CANCEL) {
                                ...detect scroll and change var...

As described here: Android - HorizontalScrollView within ScrollView Touch Handling

And here: Android horizontal scollview behave like iPhone (paging)

share|improve this answer
Can anyone help me by giving sample program.... –  Saran May 21 '11 at 12:17

ViewPager from Compatibility package is currently the best option. http://developer.android.com/reference/android/support/v4/view/ViewPager.html

share|improve this answer

You can use ViewFlipper with animation to do this but for Touch event you have to crate Custom view. http://www.androidpeople.com/android-viewflipper-example

share|improve this answer

Your Answer


