Java Code Examples for com.astuetz.PagerSlidingTabStrip#setViewPager()
The following examples show how to use
com.astuetz.PagerSlidingTabStrip#setViewPager() .
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: MainActivity.java From Android-ParallaxHeaderViewPager with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mMinHeaderHeight = getResources().getDimensionPixelSize(R.dimen.min_header_height); mHeaderHeight = getResources().getDimensionPixelSize(R.dimen.header_height); mMinHeaderTranslation = -mMinHeaderHeight; setContentView(R.layout.activity_main); mHeader = findViewById(R.id.header); info = (TextView) findViewById(R.id.info); mPagerSlidingTabStrip = (PagerSlidingTabStrip) findViewById(R.id.tabs); mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setOffscreenPageLimit(4); mPagerAdapter = new PagerAdapter(getSupportFragmentManager()); mPagerAdapter.setTabHolderScrollingContent(this); mViewPager.setAdapter(mPagerAdapter); mPagerSlidingTabStrip.setViewPager(mViewPager); mPagerSlidingTabStrip.setOnPageChangeListener(this); mLastY=0; }
Example 2
Source File: TvShowLibraryOverviewFragment.java From Mizuu with Apache License 2.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.viewpager_with_tabs, container, false); if (MizLib.hasLollipop()) ((ActionBarActivity) getActivity()).getSupportActionBar().setElevation(0); mViewPager = (ViewPager) v.findViewById(R.id.awesomepager); mViewPager.setPageMargin(MizLib.convertDpToPixels(getActivity(), 16)); mTabs = (PagerSlidingTabStrip) v.findViewById(R.id.tabs); mViewPager.setAdapter(new PagerAdapter(getChildFragmentManager())); mTabs.setViewPager(mViewPager); mTabs.setVisibility(View.VISIBLE); // Work-around a bug that sometimes happens with the tabs mViewPager.setCurrentItem(0); if (MizLib.hasLollipop()) mTabs.setElevation(1f); return v; }
Example 3
Source File: MovieLibraryOverviewFragment.java From Mizuu with Apache License 2.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.viewpager_with_tabs, container, false); if (MizLib.hasLollipop()) ((ActionBarActivity) getActivity()).getSupportActionBar().setElevation(0); mViewPager = (ViewPager) v.findViewById(R.id.awesomepager); mViewPager.setPageMargin(MizLib.convertDpToPixels(getActivity(), 16)); mTabs = (PagerSlidingTabStrip) v.findViewById(R.id.tabs); mViewPager.setAdapter(new PagerAdapter(getChildFragmentManager())); mTabs.setViewPager(mViewPager); mTabs.setVisibility(View.VISIBLE); // Work-around a bug that sometimes happens with the tabs mViewPager.setCurrentItem(0); if (MizLib.hasLollipop()) mTabs.setElevation(1f); return v; }
Example 4
Source File: AppDetailsActivity.java From Kernel-Tuner with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_application_details); Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar); setSupportActionBar(toolbar); ViewPager mPager = (ViewPager)findViewById(R.id.pager); AppDetailsPagerAdapter mPagerAdapter = new AppDetailsPagerAdapter(getSupportFragmentManager(), this); mPager.setAdapter(mPagerAdapter); PagerSlidingTabStrip tabs = (PagerSlidingTabStrip)findViewById(R.id.tabs); tabs.setViewPager(mPager); }
Example 5
Source File: MainPagerActivity.java From Man-Man with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { // should set theme prior to instantiating compat actionbar etc. Utils.setupTheme(this); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_pager); mActionBar = (Toolbar) findViewById(R.id.app_toolbar); setSupportActionBar(mActionBar); mPager = (ViewPager) findViewById(R.id.page_holder); mPager.setAdapter(new ManFragmentPagerAdapter(getSupportFragmentManager())); PagerSlidingTabStrip tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs); tabs.setViewPager(mPager); // setting up vending mDonateHelper = new DonateHelper(this); // applying default tab SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); final String index = prefs.getString("app.default.tab", "0"); mPager.setCurrentItem(Integer.valueOf(index)); }
Example 6
Source File: PagerSlidingTabStripDemoActivity.java From android-open-project-demo with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_demo); mPagerSlidingTabStrip = (PagerSlidingTabStrip) findViewById(R.id.tabs); mViewPager = (ViewPager) findViewById(R.id.pager); //设置页面之间的间隔,实际项目中应该用dip转px mViewPager.setPageMargin(10); initPageAdapter(); // mPagerSlidingTabStrip.setViewPager(mViewPager); }
Example 7
Source File: QuickContactFragment.java From UltimateAndroid with Apache License 2.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (getDialog() != null) { getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE); getDialog().getWindow().setBackgroundDrawableResource(android.R.color.transparent); } View root = inflater.inflate(R.layout.pager_sliding_tab_fragment_quick_contact, container, false); tabs = (PagerSlidingTabStrip) root.findViewById(R.id.tabs); pager = (ViewPager) root.findViewById(R.id.pager); adapter = new ContactPagerAdapter(); pager.setAdapter(adapter); tabs.setViewPager(pager); return root; }
Example 8
Source File: AboutActivity.java From Simple-Search with GNU General Public License v3.0 | 6 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activty_about); ActionBar actionBar = getSupportActionBar(); if (actionBar!=null) { actionBar.setDisplayHomeAsUpEnabled(true); } PagerSlidingTabStrip tabs = findViewById(R.id.tabs); ViewPager pager = findViewById(R.id.pager); TabsPagerAdapter adapter = new TabsPagerAdapter(getSupportFragmentManager(), this); pager.setAdapter(adapter); tabs.setViewPager(pager); }
Example 9
Source File: MainActivity.java From SoundRecorder with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); pager = (ViewPager) findViewById(R.id.pager); pager.setAdapter(new MyAdapter(getSupportFragmentManager())); tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs); tabs.setViewPager(pager); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setPopupTheme(R.style.ThemeOverlay_AppCompat_Light); if (toolbar != null) { setSupportActionBar(toolbar); } }
Example 10
Source File: MainActivity.java From BeyondUPnP with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mBeyondApplication = (BeyondApplication) getApplication(); mTabs = (PagerSlidingTabStrip) findViewById(R.id.tabs); mTabs.setShouldExpand(true); mPager = (ViewPager) findViewById(R.id.pager); mPagerAdapter = new PagerAdapter(getFragmentManager()); mPager.setAdapter(mPagerAdapter); mPager.setOffscreenPageLimit(2); mTabs.setViewPager(mPager); mTabs.setOnPageChangeListener(this); // Bind UPnP service Intent upnpServiceIntent = new Intent(MainActivity.this, BeyondUpnpService.class); bindService(upnpServiceIntent, mUpnpServiceConnection, Context.BIND_AUTO_CREATE); // Bind System service Intent systemServiceIntent = new Intent(MainActivity.this, SystemService.class); bindService(systemServiceIntent, mSystemServiceConnection, Context.BIND_AUTO_CREATE); }
Example 11
Source File: MainActivity.java From CameraColorPicker with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mToolbar = (Toolbar) findViewById(R.id.activity_main_toolbar); mToolbar.setTitle(R.string.app_name); setSupportActionBar(mToolbar); mCurrentPageId = PAGE_ID_COLOR_ITEM_LIST; mColorItemListPage = new ColorItemListPage(this); mColorItemListPage.setListener(this); mPaletteListPage = new PaletteListPage(this); mPaletteListPage.setListener(this); mFab = (FloatingActionButton) findViewById(R.id.activity_main_fab); mFab.setOnClickListener(this); final MyPagerAdapter adapter = new MyPagerAdapter(); mTabs = (PagerSlidingTabStrip) findViewById(R.id.activity_main_tabs); mViewPager = (ViewPager) findViewById(R.id.activity_main_view_pager); mViewPager.setAdapter(adapter); mTabs.setViewPager(mViewPager); mTabs.setOnPageChangeListener(this); mMainActivityFlavor = new MainActivityFlavor(this); }
Example 12
Source File: MarkActivity.java From Jreader with GNU General Public License v2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.markactivity); dm = getResources().getDisplayMetrics(); typeface = Typeface.createFromAsset(this.getAssets(),"font/QH.ttf"); button_back = (ImageButton) findViewById(R.id.back); title = (TextView) findViewById(R.id.bookname); ViewPager viewPager = (ViewPager) findViewById(R.id.pager); pagerSlidingTabStrip = (PagerSlidingTabStrip) findViewById(R.id.tabs); setTabsValue(); Intent intent = getIntent(); bookpath_intent = intent.getStringExtra("bookpath"); bookname_intent = intent.getStringExtra("bookname"); viewPager.setAdapter(new MyPagerAdapter(getSupportFragmentManager())); pagerSlidingTabStrip.setViewPager(viewPager); button_back.setOnClickListener(this); title.setText(bookname_intent); title.setTypeface(typeface); }
Example 13
Source File: EmojiKeyboardView.java From Game-of-Thrones with Apache License 2.0 | 6 votes |
@Override protected void onFinishInflate() { super.onFinishInflate(); pager = ((ViewPager) findViewById(R.id.pager)); strip = (PagerSlidingTabStrip) findViewById(R.id.tabs_strip); strip.setShouldExpand(true); Adapter adapter = new Adapter(getContext()); pager.setAdapter(adapter); strip.setViewPager(pager); backspace = findViewById(R.id.backspace); backspace.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { callback.backspaceClicked(); } }); if (adapter.recentIds.length == 0) { pager.setCurrentItem(1); } }
Example 14
Source File: StatisticsActivity.java From Simple-Solitaire with GNU General Public License v3.0 | 6 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activty_statistics); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } PagerSlidingTabStrip tabs = findViewById(R.id.tabs); tabs.setAllCaps(false); ViewPager pager = findViewById(R.id.pager); TabsPagerAdapter adapter = new TabsPagerAdapter(getSupportFragmentManager(), this); pager.setAdapter(adapter); tabs.setViewPager(pager); }
Example 15
Source File: AboutActivity.java From Simple-Solitaire with GNU General Public License v3.0 | 6 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activty_about); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } PagerSlidingTabStrip tabs = findViewById(R.id.tabs); ViewPager pager = findViewById(R.id.pager); TabsPagerAdapter adapter = new TabsPagerAdapter(getSupportFragmentManager(), this); pager.setAdapter(adapter); tabs.setViewPager(pager); }
Example 16
Source File: ViewPagerDemoActivity.java From SwipeRefreshLayout with Apache License 2.0 | 5 votes |
protected void setupViews() { setupCustomSwipeRefreshLayout(); // setup other views setupViewPagerViews(); mViewPager = (ViewPager) findViewById(R.id.viewpager); mViewPager.setAdapter(new ViewPagerAdapter(viewPagerTitles, viewPagerViews)); PagerSlidingTabStrip tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs); tabs.setViewPager(mViewPager); tabs.setAllCaps(false); }
Example 17
Source File: ProfileFragment.java From flow-android with MIT License | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View rootView = inflater.inflate(R.layout.profile_layout, container, false); userPhotoImageView = (ImageView) rootView.findViewById(R.id.user_image); userName = (TextView) rootView.findViewById(R.id.user_name); userProgram = (TextView) rootView.findViewById(R.id.user_program); coverPhotoImageView = (ImageView) rootView.findViewById(R.id.cover_photo); viewPager = (ViewPager) rootView.findViewById(R.id.pager); // Note: this is sorta cheating. We might need to decrease this number so that we don't run into memory issues. viewPager.setOffscreenPageLimit(3); Integer tabID = getArguments() != null ? getArguments().getInt(Constants.TAB_ID_KEY) : null; if (tabID == null) { // Set default tab to Schedule viewPager.setCurrentItem(Constants.PROFILE_SCHEDULE_PAGE_INDEX); } else { viewPager.setCurrentItem(tabID); } init(); if (getArguments() != null) { mProfileID = getArguments().getString(Constants.PROFILE_ID_KEY); } profilePagerAdapter = new ProfilePagerAdapter(getChildFragmentManager(), getArguments(), mProfileID == null); viewPager.setAdapter(profilePagerAdapter); tabs = (PagerSlidingTabStrip) rootView.findViewById(R.id.pager_tabs); tabs.setViewPager(viewPager); initLoaders(); populateData(); return rootView; }
Example 18
Source File: MainActivity.java From Douban with GNU General Public License v2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_main); pagerTab = (PagerSlidingTabStrip) findViewById(R.id.pager_tabs); pager = (ViewPager) findViewById(R.id.pager); pager.setOffscreenPageLimit(3); pager.setAdapter(new PagerAdapter(getSupportFragmentManager())); pagerTab.setViewPager(pager); DisplayMetrics dm = getResources().getDisplayMetrics(); float padding = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, dm); }
Example 19
Source File: FilePickerFragment.java From FilePicker with Apache License 2.0 | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_filepager, container, false); mDirPager = (ViewPager)v.findViewById(R.id.pager); mDirPager.setAdapter(mDirPagerAdapter); mIndicator = (PagerSlidingTabStrip)v.findViewById(R.id.indicator); mIndicator.setViewPager(mDirPager); mIndicator.setOnPageChangeListener(this); return v; }