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


C# ViewPager.SetOnPageChangeListener方法代码示例

本文整理汇总了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);
        }
开发者ID:jonteho,项目名称:last.fm-appcrossplat,代码行数:60,代码来源:ArtistActivity.cs

示例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 ();
 }
开发者ID:ShahmanTeh,项目名称:Xamarin.Forms-TabCarouselPage,代码行数:9,代码来源:TabCarouselPageIndicator.cs

示例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);

        }
开发者ID:slodge,项目名称:MonoDroid.ActionBar,代码行数:11,代码来源:TabsAdapter.cs

示例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);
		}
开发者ID:kruc1,项目名称:xamarin-evolve-2014,代码行数:18,代码来源:MainActivity.cs

示例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));
		}
开发者ID:jeedey93,项目名称:xamarin-android-samples,代码行数:18,代码来源:MainActivity.cs

示例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);
        }
开发者ID:MADMUC,项目名称:TAP5050,代码行数:19,代码来源:RaffleDetailRootFragment.cs

示例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));

		}
开发者ID:nowyork,项目名称:monodroid-samples,代码行数:20,代码来源:MainActivity.cs

示例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));
            }
        }
开发者ID:adbk,项目名称:spikes,代码行数:38,代码来源:MainActivity.cs

示例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

        }
开发者ID:pacificIT,项目名称:XamDroid.StickyListHeaders,代码行数:37,代码来源:Activity1.cs

示例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;
            };
            */
        }
开发者ID:jkstrawn,项目名称:wanikani_android,代码行数:24,代码来源:NewWordsActivity.cs

示例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();
        }
开发者ID:Dexyon,项目名称:ViewPagerIndicator,代码行数:14,代码来源:IconPageIndicator.cs

示例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);
        }
开发者ID:MADMUC,项目名称:TAP5050,代码行数:19,代码来源:SalesFragment.cs

示例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));
        }
开发者ID:skywolf888,项目名称:ViewPagerIndicator.Net,代码行数:32,代码来源:UnderlinePageIndicator.cs

示例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));


		}
开发者ID:Milton761,项目名称:Hitec.Droid,代码行数:101,代码来源:MainView.cs

示例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);
 }
开发者ID:MahendrenGanesan,项目名称:samples,代码行数:9,代码来源:FragmentTabsPager.cs


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