Use XML code on the activity node of manifest
<Activity Android: windowsoftinputmode = "adjustresize"/>
Android: the use of windowsoftinputmode.
How the activity interacts with the keyboard. The setting of this attribute will affect two things:
1> soft keyboard status-whether it is hidden or displayed-When activity becomes the focus of user attention.
2> adjust the main window of the activity-whether to reduce the size of the main window to free up space for the soft keyboard or whether the current focus of its content is visible when the part of the activity window is covered by the soft keyboard.
To hide the input method by default
- <Activity
- Android: Name = "viewactivity"
- Android: Label = "@ string/app_name"
- Android: windowsoftinputmode = "adjustunspecified | statehidden"
- Android: configchanges = "orientation | keyboardhidden">
- </Activity>
If the input method is displayed by default
- <Activity
- Android: Name = "viewactivity"
- Android: Label = "@ string/app_name"
- Android: windowsoftinputmode = "statevisible"
- Android: configchanges = "orientation | keyboardhidden">
- </Activity>
|
2:
Some mobile phones may fail to work using the appeal method. You can use the following methods:
Add scrollview to the layout file of edittext. When you click edittext, the widget slides and the scroll bar hides when the focus is lost.