use of android.support.v4.view.ViewPager in project danci by ling0322.
the class TabPageIndicator method setViewPager.
public void setViewPager(ViewPager view) {
if (mViewPager == view) {
return;
}
if (mViewPager != null) {
mViewPager.setOnPageChangeListener(null);
}
final PagerAdapter adapter = view.getAdapter();
if (adapter == null) {
throw new IllegalStateException("ViewPager does not have adapter instance.");
}
mViewPager = view;
view.setOnPageChangeListener(this);
notifyDataSetChanged();
}
use of android.support.v4.view.ViewPager in project fresco by facebook.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ViewPager pager = (ViewPager) findViewById(R.id.pager);
mAdapter = new MyPagerAdapter(pager.getChildCount());
pager.setAdapter(mAdapter);
}
use of android.support.v4.view.ViewPager in project quickstart-android by firebase.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Create the adapter that will return a fragment for each section
mPagerAdapter = new FragmentPagerAdapter(getSupportFragmentManager()) {
private final Fragment[] mFragments = new Fragment[] { new RecentPostsFragment(), new MyPostsFragment(), new MyTopPostsFragment() };
private final String[] mFragmentNames = new String[] { getString(R.string.heading_recent), getString(R.string.heading_my_posts), getString(R.string.heading_my_top_posts) };
@Override
public Fragment getItem(int position) {
return mFragments[position];
}
@Override
public int getCount() {
return mFragments.length;
}
@Override
public CharSequence getPageTitle(int position) {
return mFragmentNames[position];
}
};
// Set up the ViewPager with the sections adapter.
mViewPager = (ViewPager) findViewById(R.id.container);
mViewPager.setAdapter(mPagerAdapter);
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(mViewPager);
// Button launches NewPostActivity
findViewById(R.id.fab_new_post).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(MainActivity.this, NewPostActivity.class));
}
});
}
use of android.support.v4.view.ViewPager in project ZoomHeader by githubwing.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
mViewPager = (ViewPager) findViewById(R.id.viewpager);
mZoomHeader = (ZoomHeaderView) findViewById(R.id.zoomHeader);
mViewPager.setAdapter(new Adapter());
mViewPager.setOffscreenPageLimit(4);
CtrlLinearLayoutManager layoutManager = new CtrlLinearLayoutManager(this);
//未展开禁止滑动
layoutManager.setScrollEnabled(false);
mRecyclerView.setLayoutManager(layoutManager);
mRecyclerView.setAdapter(new ListAdapter());
mRecyclerView.setAlpha(0);
mBottomView = (RelativeLayout) findViewById(R.id.rv_bottom);
}
use of android.support.v4.view.ViewPager in project android-pathview by geftimov.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final ViewPager viewpager = (ViewPager) findViewById(R.id.viewpager);
final ScreenSlidePagerAdapter screenSlidePagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
viewpager.setAdapter(screenSlidePagerAdapter);
viewpager.setPageTransformer(true, new CustomTransformer());
}
Aggregations