make enter button clickable?
I have an EditText
box and when you click it the soft keyboard comes up as usu开发者_运维知识库al, but how do make it so that when the enter button gets pressed it performs a action like your pushing enter, search, or go?
thank you.
This will work for you.
editTextBox.setOnKeyListener(new OnKeyListener()
{
public boolean onKey(View v, int keyCode, KeyEvent event)
{
if ((event.getAction() == KeyEvent.ACTION_DOWN)
&& (keyCode == KeyEvent.KEYCODE_ENTER))
{
//Code here
return true;
}
return false;
}
});
精彩评论