Java Code Examples for android.support.v4.view.ViewPager#setPageTransformer()
The following examples show how to use
android.support.v4.view.ViewPager#setPageTransformer() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SlideShowDialogFragment.java From CameraBlur with Apache License 2.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_image_slider, container, false); viewPager = (ViewPager) v.findViewById(R.id.viewpager); setHasOptionsMenu(true); toolbar=(Toolbar)v.findViewById(R.id.slider_toolbar); save=v.findViewById(R.id.save_Item); setToolbar(); //((AppCompatActivity)getActivity()).setSupportActionBar(toolbar); images=getArguments().getStringArray("path"); selectedPosition = getArguments().getInt("position"); size=getArguments().getInt("total"); myViewPagerAdapter = new MyViewPagerAdapter(); viewPager.setPageTransformer(true,new ZoomOutPageTransformer()); viewPager.setAdapter(myViewPagerAdapter); viewPager.addOnPageChangeListener(viewPagerPageChangeListener); setCurrentItem(selectedPosition); return v; }
Example 2
Source File: PlayActivity.java From LitePlayer with Apache License 2.0 | 6 votes |
/** * 初始化view */ private void setupViews() { mPlayContainer = (LinearLayout) findViewById(R.id.ll_play_container); mPlayBackImageView = (ImageView) findViewById(R.id.iv_play_back); mMusicTitle = (TextView) findViewById(R.id.tv_music_title); mViewPager = (ViewPager) findViewById(R.id.vp_play_container); mPlaySeekBar = (SeekBar) findViewById(R.id.sb_play_progress); mStartPlayButton = (ImageButton) findViewById(R.id.ib_play_start); mPagerIndicator = (PagerIndicator) findViewById(R.id.pi_play_indicator); // 动态设置seekbar的margin MarginLayoutParams p = (MarginLayoutParams) mPlaySeekBar.getLayoutParams(); p.leftMargin = (int) (App.sScreenWidth * 0.1); p.rightMargin = (int) (App.sScreenWidth * 0.1); mPlaySeekBar.setOnSeekBarChangeListener(mSeekBarChangeListener); initViewPagerContent(); mViewPager.setPageTransformer(true, new PlayPageTransformer()); mPagerIndicator.create(mViewPagerContent.size()); mViewPager.setOnPageChangeListener(mPageChangeListener); mViewPager.setAdapter(mPagerAdapter); mPlayBackImageView.setOnClickListener(this); }
Example 3
Source File: ImagesLookerActivity.java From BigApp_Discuz_Android with Apache License 2.0 | 6 votes |
public boolean initWidget() { setContentView(R.layout.activity_imagelooker); ImageLibUitls.setHomeActionBar(this); //ViewPager的adapter adapter = new ImageLookerAdapter(getSupportFragmentManager(), imagesList); pager = (ViewPager) findViewById(R.id.imagebrowser_svp_pager); mPtvPage = (PhotoTextView) findViewById(R.id.imagebrowser_ptv_page); llPage = findViewById(R.id.llPage); pager.setAdapter(adapter); pager.setPageTransformer(true, new DepthPageTransformer()); //点击了哪一个,显示哪一个 pager.setCurrentItem(mPosition, false); pager.setOnPageChangeListener(this); if (imagesList.size() <= 1) { llPage.setVisibility(View.GONE); } else { mPtvPage.setText((mPosition) + 1 + "/" + imagesList.size()); } return true; }
Example 4
Source File: MainActivity.java From PageTransformerDemo with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); //noinspection ConstantConditions getSupportActionBar().setDisplayShowTitleEnabled(false); setSpinner(); mViewPager = (ViewPager) findViewById(R.id.viewPager); mViewPager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager())); mViewPager.setPageTransformer(false, new ColorTransformer()); }
Example 5
Source File: GalleryDetailActivity.java From Nimbus with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_gallery_detail); pager = (ViewPager) findViewById(R.id.galleryViewPager); progressBar = (ProgressBar) findViewById(R.id.progressBar); adapter = new GalleryDetailAdapter(getSupportFragmentManager()); pager.setAdapter(adapter); pager.setPageTransformer(true, new RotateDownPageTransformer()); Intent i = getIntent(); if (i != null) { if (new Connection(this).isInternet()) { getGalleryData(i.getStringExtra(ID)); } else { progressBar.setVisibility(View.GONE); } } }
Example 6
Source File: ScreenShotsActivity.java From fdroidclient with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { FDroidApp fdroidApp = (FDroidApp) getApplication(); fdroidApp.applyTheme(this); super.onCreate(savedInstanceState); setContentView(R.layout.activity_screenshots); String packageName = getIntent().getStringExtra(EXTRA_PACKAGE_NAME); int startPosition = getIntent().getIntExtra(EXTRA_START_POSITION, 0); App app = AppProvider.Helper.findHighestPriorityMetadata(getContentResolver(), packageName); String[] screenshots = app.getAllScreenshots(this); ViewPager viewPager = (ViewPager) findViewById(R.id.screenshot_view_pager); ScreenShotPagerAdapter adapter = new ScreenShotPagerAdapter(getSupportFragmentManager(), screenshots); viewPager.setAdapter(adapter); viewPager.setCurrentItem(startPosition); // display some nice animation while swiping viewPager.setPageTransformer(true, new DepthPageTransformer()); }
Example 7
Source File: GalleryDetailActivity.java From Hillffair17 with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_gallery_detail); pager= (ViewPager) findViewById(R.id.galleryViewPager); progressBar= (ProgressBar) findViewById(R.id.progressBar); adapter=new GalleryDetailAdapter(getSupportFragmentManager()); pager.setAdapter(adapter); pager.setPageTransformer(true,new RotateDownPageTransformer()); Intent i=getIntent(); if(i!=null){ if(new Connection(this).isInternet()){ getGalleryData(i.getStringExtra(ID)); } else { progressBar.setVisibility(View.GONE); } } }
Example 8
Source File: SparkleMotionCompat.java From SparkleMotion with MIT License | 6 votes |
/** * Sets a {@link android.support.v4.view.ViewPager.PageTransformer} to the given ViewPager. * Using this method to set PageTransformer is required for the ViewPagers that already have * {@link SparkleAnimationPresenter} installed. * * @param viewPager ViewPager instance. * @param reversDrawingOrder Whether the ViewPager should reverse it child Views' drawing * order. * @param transformer PageTransformer instance. * @see {@link ViewPager#setPageTransformer(boolean, ViewPager.PageTransformer)} * @see {@link android.support.v4.view.ViewPager.PageTransformer} */ public static void setPageTransformer(@NonNull ViewPager viewPager, boolean reversDrawingOrder, @Nullable final ViewPager.PageTransformer transformer) { Object tagObject = viewPager.getTag(R.id.presenter_id); if (tagObject == null || !(tagObject instanceof SparkleAnimationPresenter)) { viewPager.setPageTransformer(reversDrawingOrder, transformer); return; } final SparkleAnimationPresenter presenter = (SparkleAnimationPresenter) tagObject; ViewPager.PageTransformer transformerWrapper = new ViewPager.PageTransformer() { @Override public void transformPage(View page, float position) { int pageWidth = page.getWidth(); float offset = pageWidth * -position; presenter.presentAnimations(page, position, offset); if (transformer != null) { transformer.transformPage(page, position); } } }; viewPager.setPageTransformer(reversDrawingOrder, transformerWrapper); }
Example 9
Source File: MainActivity.java From WayHoo with Apache License 2.0 | 6 votes |
private void initViews() { setSwipeBackEnable(false); mBlurImageView = (ImageView) findViewById(R.id.blur_overlay_img); mRootView = (FrameLayout) findViewById(R.id.root_view); mAddCityBtn = (Button) findViewById(R.id.add_city_btn); mAddCityBtn.setOnClickListener(this); mTitleTextView = (TextView) findViewById(R.id.location_city_textview); mLocationIV = (ImageView) findViewById(R.id.curr_loc_icon); mMainViewPager = (ViewPager) findViewById(R.id.main_viewpager); ParallaxPagerTransformer pt = new ParallaxPagerTransformer((R.id.top_part)); //pt.setBorder(20); pt.setSpeed(0.5f); mMainViewPager.setPageTransformer(false, pt); mFragmentAdapter = new WeatherPagerAdapter(this); mMainViewPager.setAdapter(mFragmentAdapter); mCirclePageIndicator = (CirclePageIndicator) findViewById(R.id.indicator); mCirclePageIndicator.setViewPager(mMainViewPager); mCirclePageIndicator.setOnPageChangeListener(this); mTitleTextView.setOnClickListener(this); findViewById(R.id.sidebarButton).setOnClickListener(this); mShareBtn = (ImageView) findViewById(R.id.shareButton); mShareBtn.setOnClickListener(this); }
Example 10
Source File: VpTransformerFragment.java From AndroidDigIn with Apache License 2.0 | 5 votes |
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View inflate = inflater.inflate(R.layout.fragment_vp_transformer, null); ViewPager vp = (ViewPager) inflate.findViewById(R.id.vp); WelcomePagerAdapter adapter = new WelcomePagerAdapter(getActivity().getSupportFragmentManager()); vp.setPageTransformer(true, new VpTransformer()); vp.setAdapter(adapter); return inflate; }
Example 11
Source File: PageActivity.java From ViewPager with Apache License 2.0 | 5 votes |
private void initPager() { pager=(ViewPager) findViewById(R.id.view_pager); PagerAdapter adapter=new ViewAdapter(pages); pager.setAdapter(adapter); switch (getIntent().getIntExtra(TransformerType.TYPE, TransformerType.NORMAL)) { case TransformerType.SCALE: pager.setPageTransformer(true, new ScalePageTransformer()); break; case TransformerType.ROTATE: pager.setPageTransformer(true, new RotatePageTransformer()); break; default:break; } }
Example 12
Source File: TutorialActivity.java From Pasta-Music with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tutorial); mButtonLeft = (Button) findViewById(R.id.tutorial_button_left); mImageButtonLeft = (ImageButton) findViewById(R.id.tutorial_button_image_left); mImageButtonRight = (ImageButton) findViewById(R.id.tutorial_button_image_right); mPageIndicator = (PageIndicator) findViewById(R.id.tutorial_page_indicator); mRelativeLayout = (RelativeLayout) findViewById(R.id.relative_layout); mViewPager = (ViewPager) findViewById(R.id.view_pager); mButtonLeft.setOnClickListener(this); mImageButtonLeft.setOnClickListener(this); mImageButtonRight.setOnClickListener(this); mImageButtonLeft.setOnLongClickListener(this); mImageButtonRight.setOnLongClickListener(this); setupFragmentList(); mAdapter = new TutorialViewPagerAdapter(getSupportFragmentManager()); mAdapter.setFragments(mFragmentList); mRelativeLayout.setBackgroundColor(Color.BLUE); mViewPager.setAdapter(mAdapter); mViewPager.addOnPageChangeListener(this); mViewPager.setPageTransformer(false, getPageTransformer()); mPageIndicator.setEngine(getPageIndicatorEngine()); mPageIndicator.setViewPager(mViewPager); //We use this to actualize the Strings mPreviousPage = 0; onPageSelected(0); }
Example 13
Source File: MainActivity.java From UPMiss with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mToolbar = (Toolbar) findViewById(R.id.toolbar); mToolbar.setNavigationIcon(R.mipmap.ic_nav_main); mToolbar.setOnMenuItemClickListener(this); mToolbar.inflateMenu(R.menu.menu_main); initSyncItem(); initTitle(); mCreate = findViewById(R.id.main_img_create); mCreate.setOnClickListener(this); mAdapter = new SectionsPagerAdapter(getFragmentManager()); mPager = (ViewPager) findViewById(R.id.container); mPager.setAdapter(mAdapter); mPager.setOnPageChangeListener(mAdapter); mPager.setPageTransformer(true, new ZoomOutPageTransformer()); mPresenter = new SyncPresenter(this); // Get the Create button Translation 56+16+8 dp mCreateTranslationY = (int) (getResources().getDisplayMetrics().density * 80); }
Example 14
Source File: MainActivity.java From android-pathview with Apache License 2.0 | 5 votes |
@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()); }
Example 15
Source File: LoanHistoryActivity.java From loaned-android with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { // If the available screen size is that of an average tablet (as defined // in the Android documentation) then allow the screen to rotate if(getResources().getBoolean(R.bool.lock_orientation)){ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } super.onCreate(savedInstanceState); setContentView(R.layout.activity_loanhistory); mFragments = new Fragment[2]; Bundle extras = getIntent().getExtras(); mDB = new DatabaseManager(this); if(extras.getBoolean(IS_FOR_ITEM)){ isForItem = true; mFragments[0] = new ItemDetailsFragment(); mFragments[1] = new ItemHistoryFragment(); Log.d(TAG, "Looking up item id: "+extras.getInt(ITEM_ID)); mItem = mDB.getItemByID(extras.getInt(ITEM_ID)); } else { mFragments[0] = new PersonDetailsFragment(); mFragments[1] = new PersonHistoryFragment(); Log.d(TAG, "Looking up person id: "+extras.getInt(PERSON_ID)); mPerson = mDB.getPersonByID(extras.getInt(PERSON_ID)); } // Set up the action bar. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Create the adapter that will return a fragment for each of the three // primary sections of the app. mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.loanhistory_viewpager); mViewPager.setAdapter(mSectionsPagerAdapter); // Set the ViewPager animation mViewPager.setPageTransformer(true, new DepthPageTransformer()); // When swiping between different sections, select the corresponding // tab. We can also use ActionBar.Tab#select() to do this if we have // a reference to the Tab. mViewPager .setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) { // Create a tab with text corresponding to the page title defined by // the adapter. Also specify this Activity object, which implements // the TabListener interface, as the callback (listener) for when // this tab is selected. actionBar.addTab(actionBar.newTab() .setText(mSectionsPagerAdapter.getPageTitle(i)) .setTabListener(this)); } mContext = this; }
Example 16
Source File: LunarView.java From Android-LunarView with Apache License 2.0 | 4 votes |
private void init(AttributeSet attrs) { /* get custom attrs */ TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.LunarView); monthBackgroundColor = a.getColor(R.styleable.LunarView_monthBackgroundColor, monthBackgroundColor); weekLabelBackgroundColor = a.getColor(R.styleable.LunarView_monthBackgroundColor, weekLabelBackgroundColor); solarTextColor = a.getColor(R.styleable.LunarView_solarTextColor, solarTextColor); lunarTextColor = a.getColor(R.styleable.LunarView_lunarTextColor, lunarTextColor); hightlistColor = a.getColor(R.styleable.LunarView_highlightColor, hightlistColor); uncheckableColor = a.getColor(R.styleable.LunarView_uncheckableColor, uncheckableColor); todayBackground = a.getDrawable(R.styleable.LunarView_todayBackground); checkedDayBackgroundColor = a.getColor(R.styleable.LunarView_checkedDayBackgroundColor, checkedDayBackgroundColor); shouldPickOnMonthChange = a.getBoolean(R.styleable.LunarView_shouldPickOnMonthChange, shouldPickOnMonthChange); a.recycle(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { /* if we're on good Android versions, turn off clipping for cool effects */ setClipToPadding(false); setClipChildren(false); } else { /* old Android does not like _not_ clipping view pagers, we need to clip */ setClipChildren(true); setClipToPadding(true); } /* set the orientation to vertical */ setOrientation(VERTICAL); weekLabelView = new WeekLabelView(getContext()); weekLabelView.setBackgroundColor(weekLabelBackgroundColor); addView(weekLabelView); viewPager = new ViewPager(getContext()); viewPager.setOffscreenPageLimit(1); addView(viewPager); monthPagerAdapter = new MonthPagerAdapter(getContext(), this); viewPager.setAdapter(monthPagerAdapter); viewPager.addOnPageChangeListener(mPageListener); viewPager.setCurrentItem(monthPagerAdapter.getIndexOfCurrentMonth()); viewPager.setPageTransformer(false, new ViewPager.PageTransformer() { @Override public void transformPage(View page, float position) { page.setAlpha(1 - Math.abs(position)); } }); }
Example 17
Source File: MainActivity.java From 500px-guideview with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);//去掉信息栏 setContentView(R.layout.activity_main); setFullscreen(); fragment00 = new GuideFragment(); fragment01 = new GuideFragment(); fragment02 = new GuideFragment(); fragment03 = new GuideFragment(); fragmentList.add(fragment00); fragmentList.add(fragment01); fragmentList.add(fragment02); fragmentList.add(fragment03); viewpager = (ViewPager) findViewById(R.id.viewpager); iv_device = (ImageView) findViewById(R.id.iv_device); iv_final_photo = (ImageView) findViewById(R.id.iv_final_photo); tv_avatar_you = (TextView) findViewById(R.id.tv_avatar_you); tv_register = (TextView) findViewById(R.id.tv_register); blurringView = (BlurringView) findViewById(R.id.blurringView); ll_rows = (LinearLayout) findViewById(R.id.ll_rows); ll_comments = (LinearLayout) findViewById(R.id.ll_comments); iv_initial_phone = (ImageView) findViewById(R.id.iv_initial_phone); View blurredView = findViewById(R.id.blurredView); blurringView.setBlurredView(blurredView); //创建adapter GuideAdapter adapter = new GuideAdapter(getSupportFragmentManager()); //设置viewpager缓存页数,默认的缓存一页,因为引导页共有4页, //所以设置缓存3页,这样所以page在滑动过程中不会重新创建 viewpager.setOffscreenPageLimit(3); viewpager.setAdapter(adapter); viewpager.setPageTransformer(true, new HKTransformer()); }
Example 18
Source File: HomeActivity.java From Pano360 with MIT License | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); HomeActivityPermissionsDispatcher.initWithPermissionCheck(this); mViewPager = (ViewPager) findViewById(R.id.viewPager); mCardAdapter = new CardPagerAdapter(); mCardAdapter.addCardItem(new CardItem(R.string.title_1, R.string.content_text_1)); mCardAdapter.addCardItem(new CardItem(R.string.title_2, R.string.content_text_2)); mCardAdapter.addCardItem(new CardItem(R.string.title_3, R.string.content_text_3)); mCardAdapter.addCardItem(new CardItem(R.string.title_4, R.string.content_text_4)); mCardAdapter.addCardItem(new CardItem(R.string.title_5, R.string.content_text_5)); mCardAdapter.addCardItem(new CardItem(R.string.title_6, R.string.content_text_6)); planeMode= (CheckBox) findViewById(R.id.plane_mode); mCardAdapter.setOnClickCallback(new CardPagerAdapter.OnClickCallback() { @Override public void onClick(int position) { videoHotspotPath=null; switch (position){ case 0: //filePath= "gz256.mp4"; //mimeType= MimeType.ASSETS | MimeType.VIDEO; filePath= "android.resource://" + getPackageName() + "/" + R.raw.demo_video; mimeType= MimeType.RAW | MimeType.VIDEO; break; case 1: Intent intent=new Intent(HomeActivity.this, FilePickerActivity.class); intent.putExtra(FilePickerActivity.ARG_FILTER, Pattern.compile("(.*\\.mp4$)||(.*\\.avi$)||(.*\\.wmv$)")); startActivityForResult(intent, 1); return; case 2: filePath="images/vr_cinema.jpg"; videoHotspotPath="android.resource://" + getPackageName() + "/" + R.raw.demo_video; mimeType= MimeType.ASSETS | MimeType.PICTURE; break; case 3: //filePath= "android.resource://" + getPackageName() + "/" + R.raw.vr_cinema; //mimeType= MimeType.RAW | MimeType.PICTURE; //mimeType= MimeType.BITMAP | MimeType.PICTURE; filePath="images/texture_360_n.jpg"; mimeType= MimeType.ASSETS | MimeType.PICTURE; break; case 4: filePath="http://cache.utovr.com/201508270528174780.m3u8"; mimeType= MimeType.ONLINE | MimeType.VIDEO; break; case 5: if(flag) throw new GirlFriendNotFoundException(); else { Toast.makeText(HomeActivity.this,"再点会点坏的哦~",Toast.LENGTH_LONG).show(); flag=true; } return; } planeModeEnabled=planeMode.isChecked(); start(); } }); mCardShadowTransformer = new ShadowTransformer(mViewPager, mCardAdapter); mViewPager.setAdapter(mCardAdapter); mViewPager.setPageTransformer(false, mCardShadowTransformer); mViewPager.setOffscreenPageLimit(3); mCardShadowTransformer.enableScaling(true); }
Example 19
Source File: IntroActivity.java From IntroActivity with Apache License 2.0 | 4 votes |
@Override protected final void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTheme(R.style.IntroActivity_Theme); // Set the content view setContentView(R.layout.intro); // Set up the progress LinearLayout mProgressLayout = (LinearLayout) findViewById(R.id.progress_layout); // Set up the back button mSkipButton = (Button) findViewById(R.id.skip_button); mSkipButton.setOnClickListener(mOnSkipClickListener); // Set up the next button mNextButton = (NextDoneButton) findViewById(R.id.next_button); mNextButton.setOnClickListener(mOnNextClickListener); // Set up the ViewPager mViewPager = (ViewPager) findViewById(R.id.view_pager); // Set up the PagerAdapter mPagerAdapter = new IntroScreenPagerAdapter(getSupportFragmentManager()); // Add the OnPageChangeListener mViewPager.addOnPageChangeListener(mOnPageChangeListener); // Set a custom animation PageTransformer mViewPager.setPageTransformer(false, new CustomAnimationPageTransformer()); // Call the initialize method to add intro screens // and set up the selected styles initialize(); // Set up the progress layout with circles setupProgressLayout(); // Set the ViewPager adapter mViewPager.setAdapter(mPagerAdapter); // Required in order to get a callback in onPageSelected mViewPager.setCurrentItem(0); }
Example 20
Source File: MainActivity.java From AndroidDigIn with Apache License 2.0 | 3 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); vp = (ViewPager)findViewById(R.id.vp); WelcomePagerAdapter adapter = new WelcomePagerAdapter(getSupportFragmentManager()); vp.setAdapter(adapter); vp.setPageTransformer(true, new WelcompagerTransformer()); }