Xamarin Android EditText enter key -
i started work xamarin studio weeks ago, , not find solution next problem: created edittext contains serial numbers. i'd ro run function after enter pressed. it's working fine, when press enter, function runs without failure, can not modify content of edittext (i can't type it).
the code:
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 function } }; this code of control:
<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" /> i tried use edittext_vonalkod.textcanged arguments, problem reserved. can modify content can not handle enter key.
thanks!
the best approach use editoraction event designed triggered on enter key press. code this:
edittext_vonalkod.editoraction += (sender, e) => { if (e.actionid == imeaction.done) { btnlogin.performclick(); } else { e.handled = false; } }; and able change text of enter button use imeoptions on xml:
<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" p1:imeoptions="actionsend" />
Comments
Post a Comment