当前位置: 首页>>代码示例>>Java>>正文


Java ViewPager.setPageTransformer方法代码示例

本文整理汇总了Java中android.support.v4.view.ViewPager.setPageTransformer方法的典型用法代码示例。如果您正苦于以下问题:Java ViewPager.setPageTransformer方法的具体用法?Java ViewPager.setPageTransformer怎么用?Java ViewPager.setPageTransformer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v4.view.ViewPager的用法示例。


在下文中一共展示了ViewPager.setPageTransformer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mViewPager = (ViewPager) findViewById(R.id.viewPager);
    mButton = (Button) findViewById(R.id.cardTypeBtn);
    ((CheckBox) findViewById(R.id.checkBox)).setOnCheckedChangeListener(this);
    mButton.setOnClickListener(this);

    mCardAdapter = new CardPagerAdapter();
    mCardAdapter.addCardItem(new CardItem(R.string.title_1, R.string.text_1));
    mCardAdapter.addCardItem(new CardItem(R.string.title_2, R.string.text_1));
    mCardAdapter.addCardItem(new CardItem(R.string.title_3, R.string.text_1));
    mCardAdapter.addCardItem(new CardItem(R.string.title_4, R.string.text_1));
    mFragmentCardAdapter = new CardFragmentPagerAdapter(getSupportFragmentManager(),
            dpToPixels(2, this));

    mCardShadowTransformer = new ShadowTransformer(mViewPager, mCardAdapter);
    mFragmentCardShadowTransformer = new ShadowTransformer(mViewPager, mFragmentCardAdapter);

    mViewPager.setAdapter(mCardAdapter);
    mViewPager.setPageTransformer(false, mCardShadowTransformer);
    mViewPager.setOffscreenPageLimit(3);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:MainActivity.java

示例2: onCreate

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
@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);

    if (Build.VERSION.SDK_INT >= 11) {
        // display some nice animation while swiping
        viewPager.setPageTransformer(true, new DepthPageTransformer());
    }
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:25,代码来源:ScreenShotsActivity.java

示例3: onCreate

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
@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);
        }
    }



}
 
开发者ID:appteam-nith,项目名称:Hillffair17,代码行数:25,代码来源:GalleryDetailActivity.java

示例4: onCreate

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
@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);
        }
    }



}
 
开发者ID:appteam-nith,项目名称:Nimbus,代码行数:25,代码来源:GalleryDetailActivity.java

示例5: onCreate

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    overridePendingTransition(R.anim.fade_in,R.anim.fade_out);
    // Set title for the ViewPager
    setTitle("ViewPager");
    // Get the view from view_pager.xml
    setContentView(R.layout.view_pager);

    // Retrieve data from MainActivity on item click event
    Intent p = getIntent();
    position = p.getExtras().getInt("id");

    ImageAdapter imageAdapter = new ImageAdapter(this);
    List<ImageView> images = new ArrayList<ImageView>();

    // Retrieve all the images
    for (int i = 0; i < imageAdapter.getCount(); i++) {
        ImageView imageView = new ImageView(this);
        //imageView.setImageResource(imageAdapter.mThumbIds[i]);
            Picasso.with(this)
                    .load(GalleryFragment.mThumbIds[i])
                    .placeholder(R.drawable.loading)
                    .error(R.drawable.error)
                    .into(imageView);
        imageView.setScaleType(ImageView.ScaleType.CENTER);
        //imageView.setScaleType(ImageView.ScaleType.CENTER);
        images.add(imageView);
    }

    // Set the images into ViewPager
    ImagePagerAdapter pageradapter = new ImagePagerAdapter(images);
    ViewPager viewpager = (ViewPager) findViewById(R.id.pager);
    viewpager.setAdapter(pageradapter);
    viewpager.setPageTransformer(true, new ZoomOutPageTransformer());
    // Show images following the position
    viewpager.setCurrentItem(position);
}
 
开发者ID:Ronak-59,项目名称:Trinity-App,代码行数:39,代码来源:ImageViewPager.java

示例6: initView

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
private void initView()
{
    mListImgView = new ArrayList<>();
    titleTexts = new ArrayList<>();

    mInflater = LayoutInflater.from(mContext);
    View view = mInflater.inflate(R.layout.view_slider_layout , this);
    mDotLayout = (LinearLayout) view.findViewById(R.id.ll_dot_group);
    mTitleTV = (TextView) view.findViewById(R.id.tv_img_desc);
    mViewPager = (ViewPager) view.findViewById(R.id.viewPager);
    mViewPager.setPageTransformer(true , new DepthPageTransformer());
    mViewPager.setOnPageChangeListener(this);

    try
    {
        Field mField = ViewPager.class.getDeclaredField("mScroller");
        mField.setAccessible(true);
        mScroller = new FixedSpeedScroller(mContext ,new AccelerateInterpolator());
        mField.set(mViewPager , mScroller);
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
}
 
开发者ID:z13538657403,项目名称:SliderImageLayout,代码行数:26,代码来源:SliderImageLayout.java

示例7: onCreate

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_pager);

    myFont = new MyFont(context);
    myFont.setAppFont((ViewGroup) findViewById(R.id.root), MyFont.FONT_REGULAR);
    pos = getIntent().getIntExtra("pos", 0);

    contentItemList = DaoController.getRestaurantImages(context);

    MyLg.e(TAG, "Size " + contentItemList.size());
    pager = (ViewPager) findViewById(R.id.myViewPager);
    adapter = new ImagePagerAdapter(getSupportFragmentManager(), contentItemList, ImagePagerAdapter.ZOOM);

    pager.setAdapter(adapter);
    pager.setPageTransformer(true, new ScaleInOutTransformer());

    pager.setCurrentItem(pos);
}
 
开发者ID:PacktPublishing,项目名称:Expert-Android-Programming,代码行数:21,代码来源:PhotosPagerActivity.java

示例8: onCreate

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.watch_layout);

    mViewRoot = findViewById(R.id.viewRoot);

    mViewPager = (ViewPager) findViewById(R.id.watchViewPager);
    mViewPager.setPageMargin(150);
    ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
    mViewPager.setAdapter(adapter);

    mViewPager.addOnPageChangeListener(this);
    ParallaxTransformer transformer = new ParallaxTransformer(1.0f, 0.5f);
    mViewPager.setPageTransformer(true ,transformer);
}
 
开发者ID:wl386123298,项目名称:ViewPagerZoomTransformer,代码行数:17,代码来源:WatchDetailActivity.java

示例9: setupViewPager

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
public static void setupViewPager(final ViewPager viewPager) {
        ViewGroup.LayoutParams layoutParams = viewPager.getLayoutParams();
        layoutParams.width = ((Activity) viewPager.getContext()).getWindowManager().getDefaultDisplay().getWidth() / 7 * 5;
        layoutParams.height = (int) ((layoutParams.width / 0.75));

        viewPager.setOffscreenPageLimit(2);

        if (viewPager.getParent() instanceof ViewGroup) {
            ViewGroup viewParent = ((ViewGroup) viewPager.getParent());
            viewParent.setClipChildren(false);
            viewPager.setClipChildren(false);
        }

        viewPager.setPageTransformer(true, new ExpandingViewPagerTransformer());

//        viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
//            @Override
//            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
//                ExpandingFragment expandingFragment = getCurrentFragment(viewPager);
//                if(expandingFragment != null && expandingFragment.isOpenend()){
//                    expandingFragment.close();
//                }
//            }
//
//            @Override
//            public void onPageSelected(int position) {
//
//            }
//
//            @Override
//            public void onPageScrollStateChanged(int state) {
//
//            }
//        });
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:36,代码来源:ExpandingPagerFactory.java

示例10: initADViewPager

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
/**
 * 初始化ADViewPager
 */
private void initADViewPager() {
    if (imageUrls == null || imageUrls.size() < 1) {
        return;
    }
    LayoutInflater.from(context).inflate(R.layout.view_ad_pager, this, true);
    dotLayout = (LinearLayout) findViewById(R.id.ll_dot);
    viewPager = (ViewPager) findViewById(R.id.viewPager_ad);
    dotLayout.removeAllViews();

    if (adImageLoader == null) {
        throw new NullPointerException("adLoader == null");
    }
    allPage = new ImageView[imageUrls.size()];
    // 热点个数与图片特殊相等
    for (int i = 0; i < imageUrls.size(); i++) {
        ImageView pageView = new ImageView(context);
        allPage[i] = pageView;
        pageView.setTag(R.id.AD_ImageView, i);
        pageView.setScaleType(ImageView.ScaleType.FIT_XY);
        adImageLoader.displayImage(context, imageUrls.get(i), pageView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        pageView.setOnClickListener(this);
    }

    if (isDisplayIndicator) {
        drawPageIndicator();
    }

    PagerAdapter adapter = new ADViewPagerAdapter();
    viewPager.setAdapter(adapter);
    viewPager.setFocusable(true);
    if (pageTransformer != null) {
        viewPager.setPageTransformer(true, pageTransformer);
    }
    viewPager.addOnPageChangeListener(new ADViewPagerChangeListener());
}
 
开发者ID:GitPhoenix,项目名称:ADViewPager,代码行数:39,代码来源:ADViewPager.java

示例11: onCreate

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_comic_read);
    Intent intent = getIntent();
    comicUrlGet = intent.getStringExtra(ComicFragment.COMICREADURL);
    comicUrl = getComicUrl(comicUrlGet);
    //pictureId = comicUrl.substring(comicUrl.lastIndexOf("/") + 1,comicUrl.lastIndexOf("."));
    //.replace(".html","_2.html");
    //Log.d("url",comicUrl);
    comicSelectPage = (Button) findViewById(R.id.comic_selectPage);
    comicSelectPage.setOnClickListener(this);
    tvComicReadPage = (TextView) findViewById(R.id.comic_readPage);
    tvComicUrlLines = (TextView) findViewById(R.id.comic_change_lines);
    tvComicUrlLines.setOnClickListener(this);
    setTVComicUrlLines(tvComicUrlLines);
    progressBar = (ProgressBar) findViewById(R.id.pb_comic_progress);
    llComicReadBar = (LinearLayout) findViewById(R.id.comic_read_llbar);
    comicPagesText = (TextView) findViewById(R.id.read_comic_pages);
    viewPager = (ViewPager) findViewById(R.id.comic_read_pager);
    //viewPager.setOnLongClickListener(this);
    viewPager.setOffscreenPageLimit(1);
    pageAdapter = new MyPageAdapter(this.getSupportFragmentManager(), comicViewPagerList);
    viewPager.setAdapter(pageAdapter);
    viewPager.setPageTransformer(true, new DepthPageTransformer());
    handler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            if (msg.what == 1) {
                llComicReadBar.setVisibility(View.GONE);
            }
        }
    };
    handler.sendEmptyMessageDelayed(1, 3000);
    queryComicUrl();
}
 
开发者ID:NicoLiutong,项目名称:miaosou,代码行数:38,代码来源:ComicReadActivity.java

示例12: onCreateView

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
@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;
}
 
开发者ID:halohoop,项目名称:AndroidDigIn,代码行数:12,代码来源:VpTransformerFragment.java

示例13: init

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
private void init() {
    mVPLayout = (ECardFlowLayout) findViewById(R.id.ecardflow_layout);
    mViewPager = (ViewPager) findViewById(R.id.viewpager);

    switch (mMode) {
        case 0:
            mVPLayout.setAnimMode(new DefaultAnimMode());
            break;
        case 1:
            mVPLayout.setAnimMode(new BlurAnimMode());
            break;
        case 2:
            mVPLayout.setAnimMode(new MoveAnimMode());
            break;
        case 3:
            mVPLayout.setAnimMode(new ScaleAnimMode());
            break;
        case 4:
            mVPLayout.setAnimMode(new CrossMoveAnimMode());
            break;
    }
    mVPLayout.setImageProvider(new DrawableImageProvider(this, res, DimenUtils.getScreenWidth(getApplicationContext()), DimenUtils.getScreenHeight(getApplicationContext())));
    for (int i = 0; i < 4; i++) {
        mList.add(ImageFragment.newInstance(str[i], res[i]));
    }

    mAdapter = new ImageAdapter(getSupportFragmentManager(), mList);
    mViewPager.setOffscreenPageLimit(3);
    mViewPager.setPageTransformer(true, new ZoomOutPageTransformer());
    mViewPager.setAdapter(mAdapter);
}
 
开发者ID:codeestX,项目名称:ECardFlow,代码行数:32,代码来源:CardFlowLayoutActivity.java

示例14: onCreate

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    onCreateDrawer();

    this.font = Fonts.getDegaws(null);


    // Create the adapter that will return a fragment for each of the three
    // primary sections of the activity.
    mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());

    // Set up the ViewPager with the sections adapter.
    viewPager = (ViewPager) findViewById(R.id.container);
    viewPager.setAdapter(mSectionsPagerAdapter);
    viewPager.setPageTransformer(false, new ViewPager.PageTransformer() {
        @Override
        public void transformPage(View page, float position) {
            // do transformation here
            final float normalizedposition = Math.abs(Math.abs(position) - 1);
            page.setScaleX(normalizedposition / 2 + 0.5f);
            page.setScaleY(normalizedposition / 2 + 0.5f);
        }
    });

    CirclePageIndicator indicator = (CirclePageIndicator) findViewById(R.id.viewpagerindicator);
    indicator.setViewPager(this.viewPager);


}
 
开发者ID:nelladragon,项目名称:scab,代码行数:32,代码来源:MainActivity.java

示例15: init

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
private void init(@LayoutRes int layoutId) {
	LayoutInflater.from(getContext()).inflate(layoutId, this, true);
	findViewById(R.id.new_account_action).setOnClickListener(this);
	findViewById(R.id.import_account_action).setOnClickListener(this);

       ViewPager viewPager = findViewById(R.id.intro);
       if (viewPager != null) {
           viewPager.setPageTransformer(false, new DepthPageTransformer());
           viewPager.setAdapter(new IntroPagerAdapter());
       }
}
 
开发者ID:TrustWallet,项目名称:trust-wallet-android,代码行数:12,代码来源:AddWalletView.java


注:本文中的android.support.v4.view.ViewPager.setPageTransformer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。