コード例 #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);
            mainFrameLayout = (FrameLayout)FindViewById(Resource.Id.mainFrameLayout);

            _v = new GestureRecognizerView(this);

            ////METHOD 1
            mainFrameLayout.AddView(_v);

            //LOCATION TEST 1
            //var xOfV = _v.GetX();
            //var yOfV = _v.GetY();
            //
            //int[] screenPOSXY = new int[2];
            //_v.GetLocationOnScreen(screenPOSXY);
            //int xOfScreenForV = screenPOSXY[0];
            //int yOfScreenForV = screenPOSXY[1];

            ////OPTIONAL METHOD 2 - (optionally add a linear layout to wrap the image holder in Main.axml) -
            // //and in code below, the linear layout surrounds the gesture recognizer

            //FrameLayout mainFrameLayout = (FrameLayout)FindViewById(Resource.Id.mainFrameLayout);
            ////LINEAR LAYOUT - which holds gesture recognizer
            //LinearLayout linearLayoutGestureHolder = (LinearLayout)View.Inflate(this, Resource.Layout.GestureHolder, null);
            //linearLayoutGestureHolder.AddView(v);
            //mainFrameLayout.AddView(linearLayoutGestureHolder);

            _imageView = FindViewById <ImageView>(Resource.Id.imageView1);

            //LOCATION 3
            //var xOfImageView = _imageView.GetX();
            //var yOfImageView = _imageView.GetY();
            //
            //int[] screenPOSXYImageView = new int[2];
            //_v.GetLocationOnScreen(screenPOSXYImageView);
            //int xOfScreenForImageView = screenPOSXY[0];
            //int yOfScreenForImageView = screenPOSXY[1];


            Button button = FindViewById <Button>(Resource.Id.MyButton);

            button.Click += ButtonOnClick;

            Button secondButton = FindViewById <Button>(Resource.Id.MySecondButton);

            secondButton.Click += SecondButtonOnClick;

            mytextView      = FindViewById <TextView>(Resource.Id.durationLabel);
            mytextView.Text = String.Format("Location:");
        }
コード例 #2
0
 public MyScaleListener(GestureRecognizerView view)
 {
     _view = view;
 }