我正式为为什么这不能正常工作而发疯。我已经尝试了几乎所有东西,但它没有正确调用 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);
}
}
}
});