活动的功能我有一个自定义画布主要活动:呼叫从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