【发布时间】:2013-04-11 23:48:57
【问题描述】:
我几周前开始使用 Xamarin Studio,但找不到下一个问题的解决方案: 创建了一个包含序列号的edittext。我想在按下 Enter 后运行一个函数。 它工作正常,当我按 Enter 时,函数运行没有失败,但我无法修改编辑文本的内容(我无法输入)。
代码:
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
}
};
这是控件的代码:
<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" />
我尝试将edittext_vonalkod.TextCanged 与它的参数一起使用,问题保留。我可以修改内容但不能处理 Enter 键。
谢谢!
【问题讨论】:
标签: android key keypress xamarin enter