示例#1
0
        protected override void OnAttached()
        {
            touchListener = new MyTouchListener();
            var numberOfTouches = (int)SwipeGestureEffect.GetNumberOfTouches(Element);

            touchListener.NumberOfTouch        = numberOfTouches;
            touchListener.InvokeSwipeDetected += TouchListener_InvokeSwipeDetected;
            this.Container.SetOnTouchListener(touchListener);
        }
示例#2
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_main);


            _layout = FindViewById <RelativeLayout>(Resource.Id.mainRelativeLayout);

            var urlImage = "http://www.kinnhom.com/wp-content/uploads/2016/07/bg-pattern-3.jpg";
            //var urlImage = "https://www.krispygirl.com/wp-content/uploads/2016/08/bg-pot.png";

            var bitImage = await GetImageBitmapFromUrl(urlImage);

            #region Show This size of image

            // Get resolution Size of Image
            var width  = bitImage.Width;
            var height = bitImage.Height;

            var textViewParams = new RelativeLayout.LayoutParams(500, 200)
            {
                LeftMargin = 50,
                TopMargin  = 100
            };

            var imageSiaeTextView = new TextView(_layout.Context)
            {
                Text = $" Width(x) {width}    Height(y) {height} "
            };
            imageSiaeTextView.SetTextColor(Color.Blue);
            _layout.AddView(imageSiaeTextView, textViewParams);


            #endregion


            var img = FindViewById <ImageView>(Resource.Id.imageView1);
            img.SetImageBitmap(bitImage);

            //Set Adjust View Bounds  for can modified position
            img.SetAdjustViewBounds(true);

            // Set Max size of Image
            img.SetMaxWidth(650);
            img.SetMaxHeight(400);

            //This is set padding left / top
            img.SetX(100);
            img.SetY(20);

            // Add event for pin coordinates
            var pinEvent = new MyTouchListener(img, _layout);
            img.SetOnTouchListener(pinEvent);
        }