[mono-android] Touch events in view
Tomasz Cielecki
tomasz at ostebaronen.dk
Thu Jun 21 12:59:07 UTC 2012
Just a thought. What happens if you comment out base.OnTouchEvent(e);
and then add return true; in the bottom? My theory that the event gets
eaten by the base implementation.
On Thu, Jun 21, 2012 at 11:12 AM, Hänke, Maik <haenke at initions.com> wrote:
> Hi,
>
>
>
> I try to get touch events in my view but only the MotionEventActions.Down
> appears. There are no Up and Down events.
>
>
>
> I tried override OnTouchEvent in my activity and it works. What is wrong in
> my view?
>
>
>
> public class TestView : View
>
> {
>
> public TestView(Context c)
>
> : base(c)
>
> {
>
> }
>
>
>
> public override bool OnTouchEvent(MotionEvent e)
>
> {
>
> base.OnTouchEvent(e);
>
>
>
> switch (e.Action)
>
> {
>
> case MotionEventActions.Down:
>
> Log.Debug("Test", "DOWN");
>
> break;
>
> case MotionEventActions.Up:
>
> Log.Debug("Test", "UP");
>
> break;
>
> case MotionEventActions.Move:
>
> Log.Debug("Test", "MOVE");
>
> break;
>
> }
>
> }
>
> }
>
>
>
> [Activity(Label = "TouchTest", MainLauncher = true)]
>
> public class Activity1 : Activity
>
> {
>
> protected override void OnCreate(Bundle bundle)
>
> {
>
> base.OnCreate(bundle);
>
>
>
> SetContentView(new TestView(this));
>
> }
>
> }
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> Monodroid mailing list
> Monodroid at lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
>
--
Med Venlig Hilsen / With Best Regards
Tomasz Cielecki
http://ostebaronen.dk
More information about the Monodroid
mailing list