2
這是很奇怪的其他所有偵聽器的工作一樣的onClick等。但這種監聽器似乎並不奏效,我的繼承人代碼:OnGenericMotionListener似乎並不奏效
public class HeloActivity extends Activity implements OnGenericMotionListener{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
View root = findViewById(R.id.root );
root.setOnGenericMotionListener(this);
}
@Override
public boolean onGenericMotion(View v, MotionEvent event) {
// TODO Auto-generated method stub
Log.d("special",v.toString());
return false;
}
}
這是爲什麼不工作?
你是否確實在視圖中調用了「動作」? –
@RafaelT是的,我相信 –
聽衆是否註冊了視圖? –