我是Java和Android Studio的初学者。我尝试实现一个OnEditorActionListener,该监听器在用户按下软键盘上的“完成”按钮时侦听。有很多代码片段可用,但是我不知道将代码放在哪里(onCreate?自己的类...)。在测试其中一些代码片段时,出现错误“无法解析符号覆盖”,请参见屏幕截图。我找到了一些有关“无法解析符号xy”的文章,但没有有关“覆盖”的文章
所以我的问题是:为什么我在这里得到“无法解析符号覆盖”?
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.frm_main_layout);
//txtMeineZahl.setOnEditorActionListener(new classDoneOnEditorActionListener()); //doesnt work so far..OK for now
EditText txtMeineZahl = (EditText) findViewById(R.id.txtMeineZahl);
txtMeineZahl.setOnEditorActionListener(new TextView.OnEditorActionListener()
{
@override ---- ERROR here
public boolean onEditorAction(TextView view, int action,KeyEvent arg2event)
{
if (action == EditorInfo.IME_ACTION_DONE)
{
//view.setFocusable(false);
Toast.makeText(getApplicationContext(),"test",Toast.LENGTH_LONG);
}
return false;
}
});
}
应该是@Override而不是@override。O必须是@Override中的大写字母。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句