几个星期前我开始使用Xamarin Studio,但无法找到下一个问题的解决方案:创建了一个包含序列号的edittext.我想Enter在按下之后运行一个功能.它工作正常,当我按下时Enter,该功能运行没有失败,但我无法修改edittext的内容(我不能输入它).
代码:
EditText edittext_vonalkod = FindViewById<EditText>(Resource.Id.editText_vonalkod);
edittext_vonalkod.KeyPress += (object sender, View.KeyEventArgs e) =>
{
if ((e.Event.Action == KeyEventActions.Down) && (e.KeyCode == Keycode.Enter))
{
//Here is the function
}
};
Run Code Online (Sandbox Code Playgroud)
这是控件的代码:
<EditText
p1:layout_width="wrap_content"
p1:layout_height="wrap_content"
p1:layout_below="@+id/editText_dolgozo_neve"
p1:id="@+id/editText_vonalkod"
p1:layout_alignLeft="@+id/editText_dolgozo_neve"
p1:hint="Vonalkód"
p1:text="1032080293"
p1:layout_toLeftOf="@+id/editText_allapot" />
Run Code Online (Sandbox Code Playgroud)
我尝试使用edittext_vonalkod.TextCanged它的参数,保留问题.我可以修改内容但无法处理Enter密钥.
谢谢!