我正式瘋了,爲什麼這不能正常工作。我已經嘗試了幾乎所有的東西,但它沒有正確調用onclick事件?Android onclick事件?
這是我收到等號(=)
The type new DialogInterface.OnClickListener(){} must implement the
inherited abstract method
DialogInterface.OnClickListener.onClick(DialogInterface, int)
後不斷告訴我添加未實現的項目我的錯誤消息。但我認爲它是用View v
實現的?
任何人都可以幫助我理解爲什麼這不能正常工作?
即使我在開始時實現了onclick監聽器,它仍然無法工作?我很困惑?
<ImageView
android:id="@+id/eraserBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dip"
android:layout_weight="1"
android:background="@drawable/selector_tool_bg"
android:src="@drawable/eraser" />
mEraserBtn = (ImageView) findViewById(R.id.eraserBtn);
mEraserBtn.setOnClickListener(new OnClickListener){
public void onClick(View v) {
// TODO Auto-generated method stub
int nBtnID = mEraserBtn.getId();
// If the mode is not changed, open the setting view. If the mode is same, close the setting view.
if(nBtnID == mEraserBtn.getId()){
if(mSCanvas.getCanvasMode()==SCanvasConstants.SCANVAS_MODE_INPUT_ERASER){
mSCanvas.toggleShowSettingView(SCanvasConstants.SCANVAS_SETTINGVIEW_ERASER);
}
else{
mSCanvas.setCanvasMode(SCanvasConstants.SCANVAS_MODE_INPUT_ERASER);
mSCanvas.showSettingView(SCanvasConstants.SCANVAS_SETTINGVIEW_ERASER, false);
}
}
}
});
提出你自己的問題,以備將來參考,如果其他人遇到同樣的問題。 – Cheesebaron 2013-03-25 22:45:08