本文整理匯總了Java中com.viewpagerindicator.CirclePageIndicator.setViewPager方法的典型用法代碼示例。如果您正苦於以下問題:Java CirclePageIndicator.setViewPager方法的具體用法?Java CirclePageIndicator.setViewPager怎麽用?Java CirclePageIndicator.setViewPager使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.viewpagerindicator.CirclePageIndicator
的用法示例。
在下文中一共展示了CirclePageIndicator.setViewPager方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreate
import com.viewpagerindicator.CirclePageIndicator; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.simple_circles);
mAdapter = new TestFragmentAdapter(getSupportFragmentManager());
mPager = (ViewPager)findViewById(R.id.pager);
mPager.setAdapter(mAdapter);
CirclePageIndicator indicator = (CirclePageIndicator)findViewById(R.id.indicator);
mIndicator = indicator;
indicator.setViewPager(mPager);
final float density = getResources().getDisplayMetrics().density;
indicator.setBackgroundColor(0xFFCCCCCC);
indicator.setRadius(10 * density);
indicator.setPageColor(0x880000FF);
indicator.setFillColor(0xFF888888);
indicator.setStrokeColor(0xFF000000);
indicator.setStrokeWidth(2 * density);
}
示例2: onCreate
import com.viewpagerindicator.CirclePageIndicator; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//The look of this sample is set via a style in the manifest
setContentView(R.layout.simple_circles_stroke);
CircleAdapter mAdapter = new CircleAdapter(getSupportFragmentManager());
mPager = (ViewPager)findViewById(R.id.pager);
mPager.setAdapter(mAdapter);
CirclePageIndicator mIndicator = (CirclePageIndicator)findViewById(R.id.indicator);
// mIndicator.setStrokeColor(0x535353);
// indicator.setStrokeColor(0xFF000000);
mIndicator.setViewPager(mPager);
}
示例3: onCreate
import com.viewpagerindicator.CirclePageIndicator; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.simple_circles_stroke);
CircleAdapter mAdapter = new CircleAdapter(getSupportFragmentManager());
mPager = (ViewPager)findViewById(R.id.pager);
mPager.setAdapter(mAdapter);
CirclePageIndicator indicator = (CirclePageIndicator)findViewById(R.id.indicator);
mIndicator = indicator;
indicator.setViewPager(mPager);
final float density = getResources().getDisplayMetrics().density;
indicator.setBackgroundColor(0xFFCCCCCC);
indicator.setRadius(10 * density);
indicator.setPageColor(0x880000FF);
indicator.setFillColor(0xFF888888);
indicator.setStrokeColor(0xFF000000);
indicator.setStrokeWidth(2 * density);
}
示例4: onCreate
import com.viewpagerindicator.CirclePageIndicator; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.simple_circles);
mAdapter = new TestFragmentAdapter(getSupportFragmentManager());
mPager = (ViewPager)findViewById(R.id.pager);
mPager.setAdapter(mAdapter);
mIndicator = (CirclePageIndicator)findViewById(R.id.indicator);
mIndicator.setViewPager(mPager);
mIndicator.setCurrentItem(mAdapter.getCount() - 1);
//You can also do: indicator.setViewPager(pager, initialPage);
}
示例5: onCreateView
import com.viewpagerindicator.CirclePageIndicator; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_home, container, false);
initializeToolbar(v);
initializeDrawerLayout();
initializeFAB(v);
// Setting activity title
getActivity().setTitle(R.string.title_activity_main);
//Set the pager with an adapter
ViewPager pager = (ViewPager) v.findViewById(R.id.view_pager);
pager.setAdapter(new HomePagerAdapter(getChildFragmentManager()));
CirclePageIndicator indicator = (CirclePageIndicator) v.findViewById(R.id.indicator);
indicator.setViewPager(pager, 0);
return v;
}
示例6: onCreate
import com.viewpagerindicator.CirclePageIndicator; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_photos);
getWindow().setBackgroundDrawable(null);
final Intent intent = getIntent();
mAlbumId = intent.getIntExtra(Utils.EXTRA_NUMBER, 0);
mUrls = intent.getStringArrayExtra(Utils.EXTRA_URL);
mViewPager = (ViewPager) findViewById(R.id.content_pager);
mAdapter = new CursorPagerAdapter<PhotoFragment>(getSupportFragmentManager(), PhotoFragment.class, mUrls);
mViewPager.setAdapter(mAdapter);
mIndicator = (CirclePageIndicator) findViewById(R.id.titles);
mIndicator.setViewPager(mViewPager);
mViewPager.setCurrentItem(mAlbumId);
// Show the Up button in the action bar.
setupActionBar();
// setupInitPhotoLayout();
if (Tools.isShowInterstitialAd(this)) {
setupAds();
}
}
示例7: onCreateView
import com.viewpagerindicator.CirclePageIndicator; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Toast.makeText(getActivity(), "onCreateView ViewPagerFragment", Toast.LENGTH_SHORT).show();
View view = inflater.inflate(R.layout.fragment_view_pager, container, false);
if (viewPagerItems != null && viewPagerItems.size() > 0) {
ViewPager pager = (ViewPager) view.findViewById(R.id.viewpager);
pager.setAdapter(new ViewPagerWithTabsAdapter(getActivity(), getActivity().getSupportFragmentManager(), viewPagerItems));
int defaultViewPagerItemSelectedPosition = defaultViewPagerItemSelectedPosition();
if (defaultViewPagerItemSelectedPosition >= 0 && defaultViewPagerItemSelectedPosition < viewPagerItems.size())
pager.setCurrentItem(defaultViewPagerItemSelectedPosition);
if (!showViewPagerIndicator()) {
pager.setOnPageChangeListener(mOnPageChangeListener);
} else {
CirclePageIndicator viewPagerIndicator = (CirclePageIndicator) view.findViewById(R.id.viewpagerindicator);
viewPagerIndicator.setViewPager(pager);
viewPagerIndicator.setVisibility(View.VISIBLE);
viewPagerIndicator.setOnPageChangeListener(mOnPageChangeListener);
}
replaceTitle(viewPagerItems.get(0).getTitleResource());
}
return view;
}
示例8: initComponents
import com.viewpagerindicator.CirclePageIndicator; //導入方法依賴的package包/類
private void initComponents(View view) throws IOException,
InterruptedException, ExecutionException, JSONException,
ParseException, LastDayException {
viewPager = (ViewPager) view.findViewById(R.id.viewpager);
indicator = (CirclePageIndicator) view.findViewById(R.id.titless);
httpTask = new HttpTask();
urls = new String[1];
urls[0] = APILink.link;
if (fileIsExist()) {
rawText = readFile();
adapter = new PageAdapter(getChildFragmentManager(), rawText);
viewPager.setAdapter(adapter);
// viewPager.setCurrentItem(3);
indicator.setViewPager(viewPager);
}
}
示例9: onCreate
import com.viewpagerindicator.CirclePageIndicator; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_first_launch);
// 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.pager);
mViewPager.setAdapter(mSectionsPagerAdapter);
//mViewPager.setPageTransformer(true, new ZoomOutPageTransformer());
//Bind the title indicator to the adapter
mPageIndicator = (CirclePageIndicator)findViewById(R.id.indicator);
mPageIndicator.setViewPager(mViewPager);
}
示例10: onCreate
import com.viewpagerindicator.CirclePageIndicator; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.instructions);
mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());
mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager.setAdapter(mSectionsPagerAdapter);
mIndicator = (CirclePageIndicator)findViewById(R.id.indicator);
mIndicator.setViewPager(mViewPager);
final float density = getResources().getDisplayMetrics().density;
mIndicator.setRadius(7 * density);
mIndicator.setFillColor(0xFFFFFFFF);
mIndicator.setPageColor(0xFF466066);
mIndicator.setStrokeColor(0xFFFFFFFF);
mIndicator.setStrokeWidth(2 * density);
mIndicator.setSnap(false);
}
示例11: initViews
import com.viewpagerindicator.CirclePageIndicator; //導入方法依賴的package包/類
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);
}
示例12: onCreate
import com.viewpagerindicator.CirclePageIndicator; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.welcome_viewpager_layout);
titleIndicator = (CirclePageIndicator)findViewById(R.id.indicator);
// Instantiate a ViewPager and a PagerAdapter.
mPager = (ViewPager) findViewById(R.id.welcome_viewpager_layout);
mPagerAdapter = new WelcomePagerAdapter2(getFragmentManager()) {};
mPager.setAdapter(mPagerAdapter);
titleIndicator.setViewPager(mPager);
titleIndicator.setCurrentItem(mPagerAdapter.getCount()-1);
titleIndicator.setCurrentItem(0);
mPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
titleIndicator.setCurrentItem(position);
// When changing pages, reset the action bar actions since they are dependent
// on which page is currently active. An alternative approach is to have each
// fragment expose actions itself (rather than the activity exposing actions),
// but for simplicity, the activity provides the actions in this sample.
invalidateOptionsMenu();
}
});
}
示例13: onCreate
import com.viewpagerindicator.CirclePageIndicator; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_help);
if(getActionBar()!=null)
getActionBar().hide();
// 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.
mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager.setAdapter(mSectionsPagerAdapter);
mIndicator = (CirclePageIndicator) findViewById(R.id.indicator);
mIndicator.setSnap(true);
mIndicator.setViewPager(mViewPager);
}
示例14: onResume
import com.viewpagerindicator.CirclePageIndicator; //導入方法依賴的package包/類
@Override
public void onResume() {
InfoFragmentPagerAdapter adapter = new InfoFragmentPagerAdapter(getChildFragmentManager());
ArrayList<Integer> lineas = new ArrayList<Integer>();
for(Integer l : DataStorage.paradas.get(numParada).getLineas()) {
lineas.add(l);
}
adapter.addItem(InfoParadaFragment.newInstance(numParada, lineas));
Parada paradaActual = DataStorage.paradas.get(numParada);
if(paradaActual.getRepetida() != null){
int otraParada = paradaActual.getRepetida().getId();
adapter.addItem(InfoParadaFragment.newInstance(otraParada, lineas));
}
vPager.setAdapter(adapter);
CirclePageIndicator indicator = (CirclePageIndicator) content.findViewById(R.id.indicator);
if(vPager.getAdapter().getCount() > 1) {
indicator.setViewPager(vPager);
} else {
indicator.setVisibility(View.GONE);
}
super.onStart();
}
示例15: onCreateView
import com.viewpagerindicator.CirclePageIndicator; //導入方法依賴的package包/類
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.viewpager_view, container, false);
ViewPager viewPager = (ViewPager) rootView.findViewById(R.id.viewpager);
CirclePageIndicator indicator = (CirclePageIndicator) rootView.findViewById(R.id.indicator);
viewPager.setAdapter(new RecyclerViewFragment.ViewPagerAdapter(getChildFragmentManager(), mFragments));
indicator.setViewPager(viewPager);
return rootView;
}