You can modify the enter button style on the keyboard.CodeClick Event in the listener button.
1. Package CN. m15.xys;
2.
3. import android. app. activity; 4. import android. OS. bundle; 5. import android. view. keyevent; 6. import android. view. inputmethod. editorinfo; 7. import android. widget. edittext; 8. import android. widget. textview; 9. import android. widget. toast; 10. import android. widget. textview. oneditexceptionlistener; 11.
12. Public class keyboardactivity extends activity {13. @ override 14. Protected void oncreate (bundle savedinstancestate) {15. setcontentview (R. layout. keyboard );
16.
17. edittext edittext0 = (edittext=findviewbyid(r.id.txt test0 );
18.
19. edittext0.setoneditexceptionlistener (New oneditexceptionlistener () {20.
21. @ override 22. public Boolean oneditexception (textview arg0, int arg1, keyevent arg2) {23. if (arg1 = editorinfo. ime_action_go) {24. toast. maketext (keyboardactivity. this, "you clicked the keypad 'go to 'button", 25. toast. length_short ). show ();
26 .}
27. Return false; 28 .}
29 .});
30. edittext edittext1 = (edittext=findviewbyid(r.id.txt test1 );
31.
32. edittext1.setoneditexceptionlistener (New oneditexceptionlistener () {33.
34. @ override 35. public Boolean oneditexception (textview arg0, int arg1, keyevent arg2) {36. if (arg1 = editorinfo. ime_action_search) {37. toast. maketext (keyboardactivity. this, "you clicked the 'search' button on the keyboard", 38. toast. length_short ). show ();
39 .}
40. Return false; 41 .}
42 .});
43. edittext edittext2 = (edittext=findviewbyid(r.id.txt Test2 );
44.
45. edittext2.setoneditexceptionlistener (New oneditexceptionlistener () {46.
47. @ override 48. public Boolean oneditexception (textview arg0, int arg1, keyevent arg2) {49. if (arg1 = editorinfo. ime_action_send) {50. toast. maketext (keyboardactivity. this, "you clicked the" send "button on the keyboard", 51. toast. length_short ). show ();
52 .}
53. Return false; 54 .}
55 .});
56. edittext edittext3 = (edittext=findviewbyid(r.id.txt test3 );
57.
58. edittext3.setoneditexceptionlistener (New oneditexceptionlistener () {59.
60. @ override 61. public Boolean oneditexception (textview arg0, int arg1, keyevent arg2) {62. if (arg1 = editorinfo. ime_action_next) {63. toast. maketext (keyboardactivity. this, "you clicked the 'Next' button on the keyboard", 64. toast. length_short ). show ();
65 .}
66. Return false; 67 .}
68 .});
69. edittext edittext4 = (edittext=findviewbyid(r.id.txt test4 );
70.
71. edittext4.setoneditexceptionlistener (New oneditexceptionlistener () {72.
73. @ override 74. public Boolean oneditexception (textview arg0, int arg1, keyevent arg2) {75. if (arg1 = editorinfo. ime_action_done) {76. toast. maketext (keyboardactivity. this, "you clicked the keypad 'complete' button", 77. toast. length_short ). show ();
78 .}
79. Return false; 80 .}
81 .});
82. edittext edittext5 = (edittext=findviewbyid(r.id.txt test5 );
83.
84. edittext5.setoneditexceptionlistener (New oneditexceptionlistener () {85.
86. @ override 87. public Boolean oneditexception (textview arg0, int arg1, keyevent arg2) {88. if (arg1 = editorinfo. ime_action_unspecified) {89. toast. maketext (keyboardactivity. this, "you clicked the keypad 'unspecified' button", 90. toast. length_short ). show ();
91 .}
92. Return false; 93 .}
94 .});
95. Super. oncreate (savedinstancestate); 96 .}
97 .}
Layout:
<? XML version = "1.0" encoding = "UTF-8"?>
<Linearlayout xmlns: Android = "http://schemas.android.com/apk/res/android"
Android: Id = "@ + ID/textviewll"
Android: Orientation = "vertical" Android: layout_width = "fill_parent"
Android: layout_height = "fill_parent">
<Edittext Android: Id = "@ + ID/txttest0"
Android: imeoptions = "actiongo"
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: hint = "special button-go"> </edittext>
<Edittext Android: Id = "@ + ID/txttest1"
Android: imeoptions = "actionsearch"
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: hint = "special button-search"> </edittext>
<Edittext Android: Id = "@ + ID/txttest2"
Android: imeoptions = "actionsend"
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: hint = "special button-Send"> </edittext>
<Edittext Android: Id = "@ + ID/txttest3"
Android: imeoptions = "actionnext"
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: hint = "special button-next"> </edittext>
<Edittext Android: Id = "@ + ID/txttest4"
Android: imeoptions = "actiondone"
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: hint = "special button-finish"> </edittext>
<Edittext Android: Id = "@ + ID/txttest5"
Android: imeoptions = "actionunspecified"
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: hint = "special button-unspecified"> </edittext>
</Linearlayout>