- At first editetext the focus waits for input and the cursor flashes.
WORKAROUND: You need to have the parent control get the focus.
Android:focusable= "true" android:focusableintouchmode= "true"
- Remove the default border, below 4.0 is the line below the EditText.
Workaround: This is because of the background of the edittext, so only need to replace its background.
Android:background= "@null"
- After you set the default display of the prompt message (for example, enter a keyword above), the message will not disappear immediately, to the input text and text displayed in the input box when the message will disappear.
Workaround: Do the processing when the Editetext focus changes.
Msearchtext.setonfocuschangelistener (new Onfocuschangelistener () {@Override public void Onfocuschange (View V, Boolean Hasfocus) { //
TODO auto-generated Method stub
if
(Hasfocus) {((EditText) v). Sethint ( ""
else {((EditText) v). Sethin T ( Please enter the keyword "); } } });
- When you click the Search button, you should let EditText lose focus and hide the IME.
WORKAROUND: Set the click Listener for the Search button, listen to the user click the Search button to get the focus of the search button, and then get the input method manager to hide the input method.
View.findviewbyid (R.ID.MENU_SEARCH_BT). Setonclicklistener ( This);
@Override Public voidOnClick (View v) {//TODO auto-generated Method Stub if(V.getid () = =R.ID.MENU_SEARCH_BT) { //Search KeywordsGetFocus (V.getrootview ()); } } Private voidGetFocus (View v) {v.setfocusable (true); V.setfocusableintouchmode (true); V.requestfocus (); Inputmethodmanager IMM= (Inputmethodmanager) This. Getactivity (). Getsystemservice (Context.input_method_service); if(Imm.isactive ()) {Imm.hidesoftinputfromwindow (Getactivity (). Getcurrentfocus (). Getwind Owtoken (),0); } }
Problems encountered during the use of Android EditText