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


Java ViewPager.setOnPageChangeListener方法代码示例

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


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

示例1: setViewPager

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
@Override
public void setViewPager(ViewPager view) {
    if (mViewPager == view) {
        return;
    }
    if (mViewPager != null) {
        mViewPager.setOnPageChangeListener(null);
    }
    PagerAdapter adapter = view.getAdapter();
    if (adapter == null) {
        throw new IllegalStateException("ViewPager does not have adapter instance.");
    }
    mViewPager = view;
    view.setOnPageChangeListener(this);
    notifyDataSetChanged();
}
 
开发者ID:SShineTeam,项目名称:Huochexing12306,代码行数:17,代码来源:IconPageIndicator.java

示例2: setViewPager

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

示例3: setViewPager

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
@Override
public void setViewPager(ViewPager view) {
	Logger.d("set ViewPager");
	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();
}
 
开发者ID:iPanelkegy,项目名称:MobileMedia,代码行数:18,代码来源:UnderLinePageIndicator.java

示例4: onCreate

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

    // Set up the action bar.
    final android.support.v7.app.ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(android.support.v7.app.ActionBar.NAVIGATION_MODE_TABS);

    SectionsPagerAdapter pageAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
    viewPager = (ViewPager) findViewById(R.id.pager);
    viewPager.setAdapter(pageAdapter);

    viewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            actionBar.setSelectedNavigationItem(position);
        }
    });

    for (int i = 0; i < pageAdapter.getCount(); i++) {
        getSupportActionBar().addTab(getSupportActionBar().newTab()
                .setText(pageAdapter.getPageTitle(i))
                .setTabListener(this));
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:ThreadExampleActivity.java

示例5: setViewPager

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
public void setViewPager(ViewPager view) {
    if (view == null) {
        removeAllViews();
        this.mViewPager = null;
    } else if (this.mViewPager != view) {
        if (this.mViewPager != null) {
            this.mViewPager.setOnPageChangeListener(null);
        }
        if (view.getAdapter() == null) {
            throw new IllegalStateException("ViewPager does not have adapter instance.");
        }
        this.mViewPager = view;
        view.setOnPageChangeListener(this);
        notifyDataSetChanged();
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:17,代码来源:TabPageIndicator.java

示例6: setViewPager

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
/**
 * Sets the associated view pager. Note that the assumption here is that the pager content
 * (number of tabs and tab titles) does not change after this call has been made.
 */
public void setViewPager(ViewPager viewPager) {
    mTabStrip.removeAllViews();

    mViewPager = viewPager;
    if (viewPager != null) {
        viewPager.setOnPageChangeListener(new InternalViewPagerListener());
        populateTabStrip();
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:SlidingTabLayout.java

示例7: setViewPager

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
public void setViewPager(ViewPager pager) {
	this.pager = pager;

	if (pager.getAdapter() == null) {
		throw new IllegalStateException("ViewPager does not have adapter instance.");
	}

	pager.setOnPageChangeListener(pageListener);

	notifyDataSetChanged();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:PagerSlidingTabStrip.java

示例8: setViewPager

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
public void setViewPager(ViewPager view) {
    if (this.mViewPager != view) {
        if (this.mViewPager != null) {
            this.mViewPager.setOnPageChangeListener(null);
        }
        if (view.getAdapter() == null) {
            throw new IllegalStateException("ViewPager does not have adapter instance.");
        }
        this.mViewPager = view;
        view.setOnPageChangeListener(this);
        notifyDataSetChanged();
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:14,代码来源:TabPageIndicator.java

示例9: setViewPager

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
public void setViewPager(ViewPager pager) {
    this.pager = pager;
    if (pager.getAdapter() == null) {
        throw new IllegalStateException("ViewPager does not have adapter instance.");
    }
    pager.setOnPageChangeListener(pageListener);
    notifyDataSetChanged();
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:9,代码来源:PagerSlidingTabStrip.java

示例10: setViewPager

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
public void setViewPager(ViewPager pager) {
    mViewPager = pager;
    PagerAdapter adp = pager == null ? null : pager.getAdapter();
    if (adp != null) {
        if (adp instanceof ItemProvider) {
            mITabProvider = (ItemProvider) adp;
        }
        pager.setOnPageChangeListener(mViewPageListener);
    }
    notifyDataSetChanged();
}
 
开发者ID:rexyren,项目名称:PageScrollView,代码行数:12,代码来源:PageScrollTab.java

示例11: initControl

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
private void initControl(){
    /*set it to be no title*/
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    /*set it to be full screen*/
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    setContentView(R.layout.activity_image_show);

    iamgeViewPager = (ViewPager) findViewById(R.id.image_pager);
    LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    iamgeViewPager.setLayoutParams(params);
    iamgeViewPager.setOnPageChangeListener(pageChangeListener);

    guidPview = (ViewGroup) findViewById(R.id.guid_point);
    setImageViewPager(false);

    delButton = (Button) findViewById(R.id.b_right_id);
    if (getIntent().getStringExtra("delete").equals("delete")) {
        delButton.setVisibility(View.GONE);
    }
    delButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mImages.size() > 1) {
                mImages.remove(cus);
                GlobalData.setImagesList(mImages);
                setImageViewPager(false);
            } else {
                mImages.remove(0);
                GlobalData.setImagesList(mImages);
                Intent intent = new Intent();
                setResult(CodeDefine.IMAGE_SHOW_RESULT, intent);
                finish();
            }
        }
    });
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:39,代码来源:ImageShowActivity.java

示例12: initViewPager

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
private void initViewPager() {
	mViewPager = (ViewPager)findViewById(R.id.mViewPager);
	mAdapetr = new BaseFragmentPagerAdapter(
			getSupportFragmentManager());
	mViewPager.setOffscreenPageLimit(1);
	mViewPager.setAdapter(mAdapetr);
	mViewPager.setOnPageChangeListener(pageListener);
}
 
开发者ID:Louis19910615,项目名称:youkes_browser,代码行数:9,代码来源:AppViewPagerActivity.java

示例13: onCreateView

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_app, null);
    mViewPager = (ViewPager) view.findViewById(R.id.app_view_pager);
    pointer = (TextView) view.findViewById(R.id.app_pointer);

    initAnimation();
    pointer.startAnimation(rotation);

    initAllApp();
    mViewPager.setOnPageChangeListener(pageChangeListener);
    return view;
}
 
开发者ID:Evan-Galvin,项目名称:FreeStreams-TVLauncher,代码行数:14,代码来源:AppFragment.java

示例14: onCreate

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

    getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
            WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);

    getSupportLoaderManager().initLoader(0, null, this);

    //Postpone transition here
    ActivityCompat.postponeEnterTransition(this);

    mPager = (ViewPager) findViewById(R.id.pager);
    mPager.setPageTransformer(false, new ParallaxPagerTransformer(R.id.image));
    mPagerAdapter = new MyPagerAdapter(getSupportFragmentManager());
    mPager.setAdapter(mPagerAdapter);
    mPager.setPageMargin((int) TypedValue
            .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, getResources().getDisplayMetrics()));
    mPager.setPageMarginDrawable(new ColorDrawable(0x22000000));

    mPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageScrollStateChanged(int state) {
            super.onPageScrollStateChanged(state);
        }

        @Override
        public void onPageSelected(int position) {
            if (mCursor != null) {
                mCursor.moveToPosition(position);
            }
            mSelectedItemId = mCursor.getLong(GalleryLoader.Query.COLUMN_IMAGE_ID);
        }
    });

    if (savedInstanceState == null) {
        if (getIntent() != null && getIntent().getData() != null) {
            mStartId = GalleryContract.GalleryEntry.getItemId(getIntent().getData());
            mSelectedItemId = mStartId;
        }
    }
}
 
开发者ID:prshntpnwr,项目名称:Monolith,代码行数:44,代码来源:ImageDetailActivity.java


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