ViewPager overview

AmazingViewPager: switch to a page view controls, also known as page switcher.AmazingViewPager switch, support, horizontal/vertical support cycle.AmazingViewPager inherited from the AdapterView, directly support the use of the Android system of Adapter.

ViewPager介绍

Open/close loop switch

You can according to the demand for open or closed loop switch:

setCircularEnabled(boolean);
Switch to true, open loop;Switch to false, the closed loop.The default value is true.

Set the switch direction

You can set in different application AmazingViewPager switch direction:

 
setTouchOrientation(int);
 
Parameter value scope: AmazingViewPager. HORIZONTAL transverse switching, AmazingViewPager. VERTICAL longitudinal switch.
 

Page switching listeners

You can use the listener to monitor page switch, switch to the page when dealing with your logic.

 
OnPageChangedListener
 
Page switching listeners

Listening to the page to switch

To monitor page switching, you need to OnPageChangedListener onPageChanged in the listener () method.When the page will switch control callback this method.

The following is a typical usage:


public class PagerActivity extends Activity implements OnPageChangedListener {
    private AmazingViewPager mPager;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        mPager = (AmazingViewPager) findViewById(R.id.pager);
        mPager.setOnPageChangedListener(this);
    }

    @Override
    public void onPageChanged(AmazingViewPager pager, int currentPage, int oldPage) {
        //TODO:on pang changed
    }
}