Back to project page Android-DirectionalViewPager.
The source code is released under:
Apache License
If you think the Android project Android-DirectionalViewPager listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.directionalviewpager.sample; //w ww . j a v a2s . co m import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.view.View; import android.widget.Button; import com.directionalviewpager.DirectionalViewPager; public class SampleActivity extends FragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); //Set up the pager final DirectionalViewPager pager = (DirectionalViewPager)findViewById(R.id.pager); pager.setAdapter(new TestFragmentAdapter(getSupportFragmentManager())); //Bind to control buttons ((Button)findViewById(R.id.horizontal)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { pager.setOrientation(DirectionalViewPager.HORIZONTAL); } }); ((Button)findViewById(R.id.vertical)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { pager.setOrientation(DirectionalViewPager.VERTICAL); } }); } }