这是我的代码 - PadsGrid 是一个 ViewGroup - :
public class Emc_PadControllerActivity extends Activity implements OnTouchListener {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final PadsGrid pg = new PadsGrid(this, 8, 5, PadType.SMALL);
for (int i=0;i<pg.getChildCount();i++){
final PadController pc;
pc=(View) pg.getChildAt(i);
pc.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View arg0, MotionEvent arg1) {
pc.onTouch(arg0,arg1);
return true;
}});;
}
setContentView(pg);
}
@Override
public boolean onTouch(View v, MotionEvent event) {
v.onTouchEvent(event);
return false;
}
}
在此,我的观点的 onTouch 事件不是我为什么要触摸它们,为什么?