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


C# ImageView.SetOnTouchListener方法代码示例

本文整理汇总了C#中ImageView.SetOnTouchListener方法的典型用法代码示例。如果您正苦于以下问题:C# ImageView.SetOnTouchListener方法的具体用法?C# ImageView.SetOnTouchListener怎么用?C# ImageView.SetOnTouchListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ImageView的用法示例。


在下文中一共展示了ImageView.SetOnTouchListener方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PhotoViewDroidAttacher

        public PhotoViewDroidAttacher(ImageView imageView)
        {
            mImageView = new Java.Lang.Ref.WeakReference(imageView);
            imageView.DrawingCacheEnabled = true;
            imageView.SetOnTouchListener (this);
            ViewTreeObserver observer = imageView.ViewTreeObserver;
            if (null != observer)
                observer.AddOnGlobalLayoutListener(this);

            // Make sure we using MATRIX Scale Type
            SetImageViewScaleTypeMatrix (imageView);

            if (imageView.IsInEditMode) {
                return;
            }

            // Create Gesture Detectors...
            mScaleDragDetector = VersionedGestureDetector.NewInstance(
                imageView.Context, this);
            mGestureDetector = new GestureDetector (imageView.Context, new MSimpleOnGestureListener (this));

            mGestureDetector.SetOnDoubleTapListener (new DefaultOnDoubleTapListener (this));

            SetZoomable (true);
        }
开发者ID:Manne990,项目名称:PhotoViewerTest,代码行数:25,代码来源:PhotoViewDroidAttacher.cs

示例2: OnCreate

		//Metodo principal en el cual se creara el servicio y pintaremos nuestro imageview sobre la ventana
		public override void OnCreate ()
		{
			base.OnCreate ();
			//incializaremos en windowmanager obteniendo el servicio directo de la ventan del sistema y haremos
			//un casting de tipo JavaCast<IWindowManager>
			windowManager = GetSystemService ("window").JavaCast<IWindowManager> ();
			//inicializaremos nuestro imageview dandole los atributos de nuestra clase para que obtenga los metodos
			//de touch
			chatHead = new ImageView(this);
			//definimos la imagen del imageview
			chatHead.SetImageResource (Resource.Drawable.ic_launcher);
			//Asignamos el listener del touch nuestra clase del tipo View.IOnTouchListener
			chatHead.SetOnTouchListener (this);
			//instanciamos los parametros que necesitamos para poder tomar la pantalla y asi poder mostrar nuestro imageview
			param = new WindowManagerLayoutParams(
				WindowManagerLayoutParams.WrapContent,
				WindowManagerLayoutParams.WrapContent,
				WindowManagerTypes.Phone,
				WindowManagerFlags.NotFocusable,
				Format.Translucent);
			//Agregamos la propiedad de gravedad en la parte de arriba hacia la izquieda
			param.Gravity = GravityFlags.Top | GravityFlags.Left;
			//Asignamos la posicion X del imageview
			param.X = 0;
			//Asignamos la posicion Y del imageview
			param.Y = 100;
			//Agregamos una vista a la ventana del sistema con nuestro imageview y los parametros generados
			windowManager.AddView (chatHead, param);
		}
开发者ID:EnriqueProinfo,项目名称:Mono,代码行数:30,代码来源:ChatHeadService.cs

示例3: OnElementChanged

		// ---------------------------------------------------------------------------
		//
		// METHODS
		//
		// ---------------------------------------------------------------------------

		//
		// Use this method to customize the native control as desired
		//
		protected override void OnElementChanged(ElementChangedEventArgs<Image> e) {
			base.OnElementChanged (e);
			if (e.NewElement != null) {
				// Grab the Xamarin.Forms element from the incoming event
				formsElement = e.NewElement as CustomImage;
				// Grab the native implementation of the Xamarin.Forms element from the incoming event
				nativeElement = Control as ImageView;
				// Use this object to handle the touch events coming from the native elemtn
				nativeElement.SetOnTouchListener (this);
				// Create a gesture detector, and use this object to handle its events
				_gestureDetector = new GestureDetector (this);
			}
		}
开发者ID:ChandrakanthBCK,项目名称:customer-success-samples,代码行数:22,代码来源:CustomImageRenderer.cs

示例4: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            SetContentView (Resource.Layout.full_image);

            imagePosition = Intent.GetIntExtra("IMAGE",0);

            image = FindViewById<ImageView> (Resource.Id.imageView1);
            image.SetImageResource(imageIds[imagePosition]);
            image.SetOnTouchListener(this);

            Button mbtnBack = FindViewById<Button> (Resource.Id.backBtn2);
            mbtnBack.Click += delegate {
                Finish();
            };
        }
开发者ID:bny-mobile,项目名称:My_Mono,代码行数:16,代码来源:Activity3b.cs

示例5: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            SetContentView(Resource.Layout.touch);

            group = (ViewGroup)FindViewById(Resource.Id.root);
            image = new ImageView(this);
            image.SetImageResource(Resource.Drawable.androids);//set image(80x80px)
            image.SetOnTouchListener(this);

            startLayoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
            startLayoutParams.LeftMargin = 50;
            startLayoutParams.TopMargin = 50;
            startLayoutParams.BottomMargin = -250;
            startLayoutParams.RightMargin = -250;

            image.LayoutParameters=startLayoutParams;
            group.AddView(image);
        }
开发者ID:bny-mobile,项目名称:My_Mono,代码行数:19,代码来源:Activity6.cs

示例6: OnCreate

        //int height, oldX, oldY, X, Y;
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            SetContentView (Resource.Layout.card_table);

            group = (ViewGroup)FindViewById (Resource.Id.Main);
            ivBottom = FindViewById<ImageView> (Resource.Id.ivBottom);
            ivRight = FindViewById<ImageView> (Resource.Id.ivRight);
            ivTop = FindViewById<ImageView> (Resource.Id.ivTop);
            ivLeft = FindViewById<ImageView> (Resource.Id.ivLeft);
            lp = (RelativeLayout.LayoutParams)ivBottom.LayoutParameters;
            layoutParams = new RelativeLayout.LayoutParams (lp.Width, lp.Height);
            image = new ImageView (this);
            RunOnUiThread (() => {
                image.SetBackgroundResource (Resource.Drawable.blank_small);
                image.SetImageResource (Resource.Drawable.back);
                //image.Click += Remove_OnTouch;
                image.SetOnTouchListener (this);
                image.LayoutParameters = layoutParams;
                group.AddView (image);
            });
            MyAnimationListener.AnimationEnded += AnimationEndedHandler;

            Deck deck = new Deck (0);
            cards = deck.ShuffledStack;
            //card = cards.Pop ();
        }
开发者ID:bny-mobile,项目名称:Cards,代码行数:28,代码来源:ActivityCardTable.cs

示例7: CreateSortObjects

    private List<View> CreateSortObjects(Context context, Text2Speech tts)
    {
      var result = new List<View>();

      var x = ParseXml(context);
      //var p = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
      //p.SetMargins(5, 5, 5, 5);

      //for (int i = 1; i < 15; ++i)
      //{
      //  var s = new TextView(context);
      //  s.Text = ("View " + i.ToString());
      //  s.LayoutParameters = (p);
      //  result.Add(s);
      //}

      var s = new ShapeView(context, ShapeView.ShapeEnum.RectangleShape, 100, 100, Color.DKGRAY);
      //var d = new DragHandler { CheckerData = sortObjects.ResultChecker.CreateCheckerData("1") };
      //s.SetOnDragListener(d);
      //s.SetOnLongClickListener(d);
      //s.SetOnTouchListener(d);
      //s.LayoutParameters = (p);
      //result.Add(s);

      //s = new ShapeView(context, ShapeView.ShapeEnum.OvalShape, 100, 75, Color.WHITE);
      //d = new DragHandler { CheckerData = sortObjects.ResultChecker.CreateCheckerData("2") };
      //s.SetOnDragListener(d);
      //s.SetOnLongClickListener(d);
      //s.SetOnTouchListener(d);
      //s.LayoutParameters = (p);
      //result.Add(s);

      //s = new ShapeView(context, ShapeView.ShapeEnum.TriangleShape, 100, 100, Color.MAGENTA);
      //d = new DragHandler { CheckerData = sortObjects.ResultChecker.CreateCheckerData("1") };
      //s.SetOnDragListener(d);
      //s.SetOnLongClickListener(d);
      //s.SetOnTouchListener(d);
      //s.LayoutParameters = (p);
      //result.Add(s);

      //s = new ShapeView(context, ShapeView.ShapeEnum.RoundedRectShape, 100, 100, Color.YELLOW);
      //d = new DragHandler { CheckerData = sortObjects.ResultChecker.CreateCheckerData("2") };
      //s.SetOnDragListener(d);
      //s.SetOnLongClickListener(d);
      //s.SetOnTouchListener(d);
      //s.LayoutParameters = (p);
      //result.Add(s);

      var p = new LinearLayout.LayoutParams(120, 120);
      p.SetMargins(5, 5, 5, 5);

      var i = new ImageView(context);
      i.SetScaleType(Android.Widget.ImageView.ScaleType.CENTER_INSIDE);
      i.SetImageResource(R.Drawable.Laura);
      //- i.SetImageDrawable(Drawable.CreateFromPath("res/drawable/laura.png"));
      i.LayoutParameters = (p);
      var d = new MoveDragHandler { CheckerData = sortObjects.ResultChecker.CreateCheckerData("1") };
      var t = new SpeechDropHandler { Tts = tts, Text = "This is Laura" };
      d.Successor = t;
      i.SetOnDragListener(d);
      i.SetOnTouchListener(d);
      result.Add(i);

      i = new ImageView(context);
      i.SetScaleType(Android.Widget.ImageView.ScaleType.CENTER_INSIDE);
      i.SetImageResource(R.Drawable.Inge);
      //- i.SetImageDrawable(Drawable.CreateFromPath("res/drawable/laura.png"));
      i.LayoutParameters = (p);
      d = new MoveDragHandler { CheckerData = sortObjects.ResultChecker.CreateCheckerData("1") };
      t = new SpeechDropHandler { Tts = tts, Text = "This is Inge" };
      d.Successor = t;
      i.SetOnDragListener(d);
      i.SetOnTouchListener(d);
      result.Add(i);

      i = new ImageView(context);
      i.SetScaleType(Android.Widget.ImageView.ScaleType.CENTER_INSIDE);
      i.SetImageResource(R.Drawable.Emma);
      //- i.SetImageDrawable(Drawable.CreateFromPath("res/drawable/laura.png"));
      i.LayoutParameters = (p);
      d = new MoveDragHandler { CheckerData = sortObjects.ResultChecker.CreateCheckerData("2") };
      t = new SpeechDropHandler { Tts = tts, Text = "This is Emma" };
      d.Successor = t;
      i.SetOnDragListener(d);
      i.SetOnTouchListener(d);
      result.Add(i);

      i = new ImageView(context);
      i.SetScaleType(Android.Widget.ImageView.ScaleType.CENTER_INSIDE);
      i.SetImageResource(R.Drawable.Thor);
      //- i.SetImageDrawable(Drawable.CreateFromPath("res/drawable/laura.png"));
      i.LayoutParameters = (p);
      d = new MoveDragHandler { CheckerData = sortObjects.ResultChecker.CreateCheckerData("2") };
      t = new SpeechDropHandler { Tts = tts, Text = "This is Thor" };
      d.Successor = t;
      i.SetOnDragListener(d);
      i.SetOnTouchListener(d);
      result.Add(i);

      sortObjects.ResultChecker.NrAccepts = result.Count();
//.........这里部分代码省略.........
开发者ID:Xtremrules,项目名称:dot42,代码行数:101,代码来源:SortTaskFactory.cs


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