本文整理汇总了C#中ViewPager.SetOnPageChangeListener方法的典型用法代码示例。如果您正苦于以下问题:C# ViewPager.SetOnPageChangeListener方法的具体用法?C# ViewPager.SetOnPageChangeListener怎么用?C# ViewPager.SetOnPageChangeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ViewPager
的用法示例。
在下文中一共展示了ViewPager.SetOnPageChangeListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreate
protected override void OnCreate(Bundle bundle)
{
//SetTheme(Resource.Style.Theme_Sherlock_Light);
SetTheme(Resource.Style.Theme_Example);
base.OnCreate(bundle);
RequestWindowFeature(WindowFeatures.IndeterminateProgress);
SetSupportProgressBarIndeterminateVisibility(false);
Sherlock.ActionBar.SetDisplayHomeAsUpEnabled(true);
SetContentView(Resource.Layout.Main);
// Show tabs
ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;
// attach adapter to the viewpager
_pageAdapter = new ArtistPagerAdapter(SupportFragmentManager);
_viewPager = FindViewById<ViewPager>(Resource.Id.myViewPager);
_viewPager.Adapter = _pageAdapter;
_viewPager.SetOnPageChangeListener(this);
// startindex
_viewPager.SetCurrentItem(0, true);
var jsonArtist = Intent.GetStringExtra("Artist");
_artist = JsonConvert.DeserializeObject<Artist>(jsonArtist);
var jsonTopTracks = Intent.GetStringExtra("TopTracks");
_topTracks = JsonConvert.DeserializeObject<TopTracks>(jsonTopTracks);
var jsonTopAlbums = Intent.GetStringExtra("TopAlbums");
_topAlbums = JsonConvert.DeserializeObject<TopAlbums>(jsonTopAlbums);
_bitmapExtension = new BitmapExtension();
try
{
_imageBitmap = _bitmapExtension.GetImageBitmapFromUrl(_artist.GetImageUrlOfSize("large"));
}
catch (Exception ex)
{
Toast.MakeText(this, "Error: " + ex.Message, ToastLength.Short).Show();
}
//TABS
var tab1 = Sherlock.ActionBar.NewTab();
tab1.SetText("Artist");
tab1.SetTabListener(this);
var tab2 = Sherlock.ActionBar.NewTab();
tab2.SetText("Similar Artists");
tab2.SetTabListener(this);
var tab3 = Sherlock.ActionBar.NewTab();
tab3.SetText("Top 15 Tracks");
tab3.SetTabListener(this);
var tab4 = Sherlock.ActionBar.NewTab();
tab4.SetText("Top 5 Albums");
tab4.SetTabListener(this);
Sherlock.ActionBar.AddTab(tab1);
Sherlock.ActionBar.AddTab(tab2);
Sherlock.ActionBar.AddTab(tab3);
Sherlock.ActionBar.AddTab(tab4);
}
示例2: SetViewPager
public override void SetViewPager ( ViewPager view ) {
var adapter = view.Adapter;
if ( adapter == null ) {
throw new IllegalStateException ( "ViewPager does not have adapter instance." );
}
mViewPager = view;
view.SetOnPageChangeListener ( this );
NotifyDataSetChanged ();
}
示例3: TabsAdapter
public TabsAdapter(FragmentActivity activity, TabHost tabHost, ViewPager pager)
: base(activity.SupportFragmentManager)
{
_context = activity;
_tabHost = tabHost;
_viewPager = pager;
_tabHost.SetOnTabChangedListener(this);
_viewPager.Adapter = this;
_viewPager.SetOnPageChangeListener(this);
}
示例4: OnCreate
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SupportActionBar.NavigationMode = ActionBar.NavigationModeTabs;
SetContentView (Resource.Layout.Main);
content = FindViewById<ViewPager> (Resource.Id.content_frame);
content.Adapter = tabsAdapter = new TabAdapter (SupportFragmentManager);
content.SetOnPageChangeListener (this);
AddTabToActionBar (Resource.String.events_tab_label, Resource.Drawable.calendar);
AddTabToActionBar (Resource.String.animals_tab_label, Resource.Drawable.gorilla);
//AddTabToActionBar (Resource.String.about_tab_label, Resource.Drawable.ic_action_whats_on);
}
示例5: OnCreate
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.Main);
pager = FindViewById<ViewPager>(Resource.Id.myviewpager);
adapter = new MyPagerAdapter(this, this.SupportFragmentManager);
pager.Adapter = adapter;
pager.SetOnPageChangeListener (adapter);
pager.SetCurrentItem (FIRST_PAGE,true);
pager.OffscreenPageLimit = 3;
pager.PageMargin = Convert.ToInt32 (GetString(Resource.String.pagermargin));
}
示例6: OnCreate
public override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate (savedInstanceState);
rootview = new RelativeLayout (nn_activity);
rootview.LayoutParameters = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
rootview.Id=TapUtil.generateViewId ();
viewpage = new ViewPager (nn_activity);
viewpage.Id = 9999;
viewpage.LayoutParameters = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
adapter = new RaffleDetailSliderPagerAdapter (this,viewpage,ChildFragmentManager,eventcards,initialpage);
viewpage.Adapter = adapter;
viewpage.SetOnPageChangeListener(adapter);
//viewpage.SetCurrentItem (initialpage + 1, false);
rootview.AddView (viewpage);
}
示例7: OnCreate
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.Main);
view_pager = (FindViewById<ViewPager> (Resource.Id.pager));
//make the first page the white light fragment
LightFragmentAdapter adapter = new LightFragmentAdapter (SupportFragmentManager);
adapter.AddFragment (new WhiteLightFragment ());
//make the second page the party light fragment
party_fragment = new PartyLightFragment ();
adapter.AddFragment (party_fragment);
view_pager.Adapter = adapter;
view_pager.SetOnPageChangeListener (new MyOnPageListener (this));
}
示例8: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
mDemoCollectionPagerAdapter = new DemoCollectionPagerAdapter(SupportFragmentManager, new Dictionary<int, int>{
{ 0, Resource.Layout.layout1},
{ 1, Resource.Layout.layout2},
{ 2, Resource.Layout.layout3},
{ 3, Resource.Layout.layout4},
});
mViewPager = FindViewById<ViewPager>(Resource.Id.pager);
mViewPager.Adapter = mDemoCollectionPagerAdapter;
mViewPager.OffscreenPageLimit = mDemoCollectionPagerAdapter.Count; // Keep them all in memory. These are small views, who cares.
//If we want to use tab, uncomment this
var actionBar = ActionBar;
mViewPager.SetOnPageChangeListener(new OnPageChangeListener(actionBar));
actionBar.NavigationMode = ActionBarNavigationMode.Tabs;
ActionBar.ITabListener tabListener = new TabListener(mViewPager);
var tabStrip = FindViewById<PagerTabStrip>(Resource.Id.tabStrip);
bool drawFullUnderline = tabStrip.DrawFullUnderline;
tabStrip.DrawFullUnderline = !drawFullUnderline;
tabStrip.TabIndicatorColor = Android.Graphics.Color.Red;
for (int i = 0; i < mDemoCollectionPagerAdapter.Count; i++)
{
actionBar.AddTab(
actionBar.NewTab()
//.SetText("Tab " + (i + 1))
.SetText(mDemoCollectionPagerAdapter.GetPageTitle(i))
.SetTabListener(tabListener));
}
}
示例9: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
m_Pager = FindViewById<ViewPager>(Resource.Id.pager);
m_Adapter = new MainPagerAdapter(SupportFragmentManager);
m_Pager.Adapter = m_Adapter;
#if __ANDROID_11__
m_Pager.SetOnPageChangeListener(this);
ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;
var tab = ActionBar.NewTab();
tab.SetText("1");
tab.SetTabListener(this);
ActionBar.AddTab(tab);
tab = ActionBar.NewTab();
tab.SetText("2");
tab.SetTabListener(this);
ActionBar.AddTab(tab);
tab = ActionBar.NewTab();
tab.SetText("3");
tab.SetTabListener(this);
ActionBar.AddTab(tab);
tab = ActionBar.NewTab();
tab.SetText("4");
tab.SetTabListener(this);
ActionBar.AddTab(tab);
#endif
}
示例10: OnCreate
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate (savedInstanceState);
SetContentView(Resource.Layout.FragmentList);
var footer = FindViewById<TextView> (Resource.Id.footer);
adapter = new MyAdapter(SupportFragmentManager);
pager = FindViewById<ViewPager>(Resource.Id.pager);
pager.Adapter = adapter;
var mpag = new MyListener (footer);
pager.SetOnPageChangeListener (mpag);
/*
var button = FindViewById<Button>(Resource.Id.goto_first);
button.Click += (sender, e) => {
pager.CurrentItem = 0;
};
button = FindViewById<Button>(Resource.Id.goto_last);
button.Click += (sender, e) => {
pager.CurrentItem = NUM_ITEMS - 1;
};
*/
}
示例11: SetViewPager
public void SetViewPager(ViewPager view)
{
if (_viewPager == view) return;
if (null != _viewPager)
_viewPager.SetOnPageChangeListener(null);
if (null == view.Adapter)
throw new InvalidOperationException("ViewPager does not have an Adapter instance.");
_viewPager = view;
_viewPager.SetOnPageChangeListener(this);
NotifyDataSetChanged();
}
示例12: OnCreate
public override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate (savedInstanceState);
eventlist = new List<Tap5050Event> ();
goalcards=new List<GoalsCard>();
rootview = new RelativeLayout (nn_activity);
rootview.LayoutParameters = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
rootview.Id=TapUtil.generateViewId ();
viewpage = new ViewPager (nn_activity);
viewpage.Id = 9999;
viewpage.LayoutParameters = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
adapter = new SalesSliderPagerAdapter (viewpage,ChildFragmentManager,goalcards);
viewpage.Adapter = adapter;
viewpage.SetOnPageChangeListener(adapter);
rootview.AddView (viewpage);
}
示例13: setViewPager
//@Override
public void setViewPager(ViewPager viewPager)
{
if (mViewPager == viewPager)
{
return;
}
if (mViewPager != null)
{
//Clear us from the old pager.
mViewPager.SetOnPageChangeListener(null);
}
if (viewPager.Adapter == null)
{
throw new Java.Lang.IllegalStateException("ViewPager does not have adapter instance.");
}
mViewPager = viewPager;
mViewPager.SetOnPageChangeListener(this);
Invalidate();
//throw new NotImplementedException();
//Post(new Runnable() {
// @Override public void run() {
// if (mFades) {
// post(mFadeRunnable);
// }
// }
//});
Post(new FadeRun(this));
}
示例14: OnCreate
//.........这里部分代码省略.........
frontView._listLinearItem [3].Click += delegate {showCifras ();};
LinearLayout linearMainLayout = FindViewById<LinearLayout>(Resource.Id.left_drawer);
var metrics = Resources.DisplayMetrics;
widthInDp = ((int)metrics.WidthPixels);
heightInDp = ((int)metrics.HeightPixels);
Configuration.setWidthPixel (widthInDp);
Configuration.setHeigthPixel (heightInDp);
pausePlayer = Bitmap.CreateScaledBitmap(getBitmapFromAsset("icons/pause.png"),Configuration.getWidth(60),Configuration.getWidth(60),true);
task = new TaskView (this);
initRutas ();
initLinearInfo ();
iniMenu ();
mToolbar = FindViewById<SupportToolbar>(Resource.Id.toolbar);
SetSupportActionBar(mToolbar);
mToolbar.SetNavigationIcon (Resource.Drawable.transparent);
mDrawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
mLeftDrawer = FindViewById<LinearLayout>(Resource.Id.left_drawer);
//mRightDrawer = FindViewById<LinearLayout>(Resource.Id.right_drawer);
mLeftDrawer.Tag = 0;
//mRightDrawer.Tag = 1;
frameLayout = FindViewById<FrameLayout> (Resource.Id.content_frame);
main_ContentView = new RelativeLayout (this);
main_ContentView.LayoutParameters = new RelativeLayout.LayoutParams (-1, -1);
lo.header.SetBackgroundDrawable (headersDR[1]);
main_ContentView.AddView (lo);
lo.getWorkSpaceLayout.AddView (frontView);
frameLayout.AddView (main_ContentView);
//RL.SetBackgroundDrawable (dr);
//seting up chat view content
//title_view = FindViewById<TextView> (Resource.Id.chat_view_title);
linearMainLayout.AddView (mainLayout);
vm.PropertyChanged += new PropertyChangedEventHandler(logout_propertyChanged);
RegisterWithGCM();
mDrawerToggle = new MyActionBarDrawerToggle(
this, //Host Activity
mDrawerLayout, //DrawerLayout
Resource.String.openDrawer, //Opened Message
Resource.String.closeDrawer //Closed Message
);
mDrawerLayout.SetDrawerListener(mDrawerToggle);
SupportActionBar.SetHomeButtonEnabled (true);
SupportActionBar.SetDisplayShowTitleEnabled(false);
mDrawerToggle.SyncState();
if (bundle != null)
{
if (bundle.GetString("DrawerState") == "Opened")
{
SupportActionBar.SetTitle(Resource.String.openDrawer);
}
else
{
SupportActionBar.SetTitle(Resource.String.closeDrawer);
}
}
else
{
SupportActionBar.SetTitle(Resource.String.closeDrawer);
}
initListCursos ();
initListTaskTop ();
initListTaskBotton ();
viewPager = new ViewPager (this);
viewPager.SetOnPageChangeListener (new MyPageChangeListenerPager (this, listFrontPager));
}
示例15: TabsAdapter
public TabsAdapter(FragmentActivity activity, TabHost tabHost, ViewPager pager) : base(activity.GetSupportFragmentManager())
{
mContext = activity;
mTabHost = tabHost;
mViewPager = pager;
mTabHost.SetOnTabChangedListener(this);
mViewPager.SetAdapter(this);
mViewPager.SetOnPageChangeListener(this);
}