c# - Visual Studio 2015 Xamarin.Android - limit fling in Image Gallery to just one item per fling -


when swipe gallery, multiple images go right left, depending on swipe speed. can please tell me how limit swipe 1 image @ time, no matter how fast swipe?

[activity(label = "app3", mainlauncher = true, icon = "@drawable/icon")]     public class mainactivity : activity     {         protected override void oncreate(bundle bundle)         {             base.oncreate(bundle);               // set our view "main" layout resource              setcontentview (resource.layout.main);              gallery gallery = (gallery)findviewbyid<gallery>(resource.id.gallery);              gallery.adapter = new imageadapter(this);              gallery.itemclick += delegate (object sender, android.widget.adapterview.itemclickeventargs args) {                 toast.maketext(this, args.position.tostring(), toastlength.short).show();             };         }      } 

try override gallery onfling() method , don't call superclass onfling() method.

in way on swipe gallery advance 1 item time. make gallery advance 1 item per swipe.

edit: can create class extendedgallery:

public class extendedgallery : gallery     {         public extendedgallery(context context) : base(context)         {          }          public override bool onfling (motionevent e1, motionevent e2, float velocityx, float velocityy)         {             //return base.onfling (e1, e2, velocityx, velocityy);             return false;         }     } 

then use extendedgallery instead of gallery.


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -