Page when I do own a set of buttons and a text box, I want to click on the text box in the Android system comes not popInput or input method can cover the system comes to me to do the following keys, add that I used to do the layout of the buttons
TableLayoutTableRow inside the jacket sleeve button.<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Just do not pop it up inside mainfestive on the line ah, do not understand what you want to say
Reply:
The text box is EditText? android: focusable = "false" This property can be a plus
Reply:
When you click the text box does not pop up Android comes with input method, there are two methods:
1, rewrite EditText of onFocusChanged method, that is, when clicked hide the input method.
@ Override
protected void onFocusChanged (boolean focused, int direction, Rect previouslyFocusedRect) {
super.onFocusChanged (focused, direction, previouslyFocusedRect);
final InputMethodManager imm = ((InputMethodManager) getContext ()
. GetSystemService (Context.INPUT_METHOD_SERVICE));
if (imm! = null && imm.isActive (this)) {
imm.hideSoftInputFromWindow (getApplicationWindowToken (), 0);
}
}
---- This method is a little drawbacks, sometimes after clicking the input method appears briefly.
2, need to use reflection to call EditText of setShowSoftInputOnFocus (false) method, so this method is sdk hidden.
Method method;
try {
method = Class.forName ("android.view.EditText"). getMethod ("setShowSoftInputOnFocus"
, Boolean.class);
boolean show = false;
method.invoke (this.getClass (), show);
} Catch (NoSuchMethodException e) {
/ / TODO Auto-generated catch block
e.printStackTrace ();
} Catch (ClassNotFoundException e) {
/ / TODO Auto-generated catch block
e.printStackTrace ();
} Catch (IllegalArgumentException e) {
/ / TODO Auto-generated catch block
e.printStackTrace ();
} Catch (IllegalAccessException e) {
/ / TODO Auto-generated catch block
e.printStackTrace ();
} Catch (InvocationTargetException e) {
/ / TODO Auto-generated catch block
e.printStackTrace ();
}
Landlord to try!
Reply:
The second method is recommended by the landlord
No comments:
Post a Comment