活動的功能我有一個自定義畫布主要活動:呼叫從SimpleOnGestureListener
public void onCreate(Bundle savedInstanceState) {
...
CustomCanvas c = new CustomCanvas(this);
c.requestFocus();
cll = (LinearLayout)findViewById(R.id.CLL);
cll.addView(c);
}
public void qwerty(String w) {
....
TextView abc = (TextView)findViewById(R.id.TextViewabc);
abc.setText(w);
....
}
裏面CustomCanvas,我有一個SimpleOnGestureListener GestureDetector。 我想從SimpleOnGestureListener的方法(如onSingleTapConfirmed)調用qwerty()
這可能嗎?如果不是,還有另外一種方式嗎? 感謝
....編輯.....(詳細信息)
GestureDetector是一個對象,我CustomCanvas
public class CustomCanvas extends View {
GestureDetector gd;
...
public CustomCanvas(final Context context) {
super(context);
gd = new GestureDetector(getContext(), new SimpleOnGestureListener() {
....
// I also use getScrollX() and getScrollY() in some of the methods here
});
}
....
@Override
public boolean onTouchEvent(MotionEvent ev) {
return gd.onTouchEvent(ev);
}
}
也向我們展示'GestureDetector'。這是在同一班? – 2012-01-02 13:00:26