How to build a rotation gesture

Shay Wilner 1,726 Reputation points
2024-02-27T15:01:03.6566667+00:00

Hello on platform xamarin android app I tried to build a rotation gesture for ex open a ball valve valve i add an interface

namespace plx
{
    internal interface IONROTATIONGESTURELISTNER
    {
        void OnRotateStarted(MotionEvent Event);
        void OnRotateCompleted(MotionEvent Event);
        void OnRotate(MotionEvent Event, float angle);
    }
}
namespace plx
{
     class RotationGestureDetector
    {
        public RotationGestureDetector(IONROTATIONGESTURELISTNER listener)
        {
            
        }
        public bool OnTouchEvent(MotionEvent e)
        { 
           switch (e.ActionMasked) 
            
            { 
                case MotionEventActions.Down: return true;  
                    case MotionEventActions.Up: return true;
                case MotionEventActions.PointerDown: return true;
                    case MotionEventActions.PointerUp: return true;
                    case MotionEventActions.Move: return true;  
                    default: return false;  
            
            
            }
        }
    }
}


How i bind RotationGestureDetector class to an imageview Thanks

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,293 questions
0 comments No comments
{count} votes

Accepted answer
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 35,291 Reputation points Microsoft Vendor
    2024-02-28T03:00:32.52+00:00

    Hello,

    For how to implement a custom gesture in Xamarin.Android and bind it to a view, the official documentation has provided specific instructions and use cases.

    Please refer to the following documentation and sample:

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful