2011-06-03 30 views

回答

3

您正在查看的方法是Activity.OnTouchEvent,它看起來與Java中的方法相同。你正在看的例子實際上是使用OnTouchListener.onTouch方法,它在Mono For Android中映射到IOnTouchListener.OnTouch。實現這個界面的基本類定義看起來像這樣:

public class Touch : Activity, View.IOnTouchListener 
{ 
    protected override void OnCreate(Bundle bundle) 
    { 
     base.OnCreate(bundle); 
    } 

    public bool OnTouch(View v, MotionEvent e) 
    { 
     return true; 
    } 
} 
+0

謝謝!我明白了,那麼事件需要使用SetOnTouchListener進行分配(http://docs.mono-android.net/Android.Views.View.SetOnTouchListener%20%28Android.Views.View+IOnTouchListener%29) – 2011-06-09 13:51:37