windowSoftInputMode is an attribute in Android that defines how the activity window should adjust when the screen has focus and the soft keyboard (i.e. the on-screen keyboard) needs to be displayed. The attribute is located in the AndroidManifest.xml file and is set for each <activity> tag. windowSoftInputMode has multiple possible values, which can be divided into two categories: state-prefixed values and adjust-prefixed values.
stateUnspecified: The default state of the soft keyboard is determined by the system. stateUnchanged: The soft keyboard will remain in its last state, whether visible or hidden. stateHidden: When the Activity is created, the soft keyboard is hidden. stateAlwaysHidden: The soft keyboard is always hidden, even if the user selects a field that requires text entry. stateVisible: When the Activity is created, the soft keyboard is visible. stateAlwaysVisible: The soft keyboard is always visible.
Set in AndroidManifest.xml: Set in code: These values can be combined by separating them with the "|" symbol. In the above code, stateHidden and adjustResize are combined together. Common properties of windowSoftInputMode are adjustPan, adjustResize, adjustNothing adjustPanThe window content will not be resized, but will be translated upward so that the currently focused field is not blocked by the keyboard. The size of the Activity window (DecorView) remains unchanged. When the focused EditText is located at the bottom of the screen and the soft keyboard pops up to block the EditText, the entire DecorView will move up, but how much it will move up is uncertain. Generally, it will move up until the EditText is just not blocked by the soft keyboard. picture adjustResizeWhen the soft keyboard is displayed, the window will be resized to make room for the soft keyboard. This usually means that the content of the window will move up to make room for the keyboard. The size of the DecorView will not change, and the content area contentView (id = android.R.content) will shrink accordingly to make room for the keyboard. picture Note: adjustResize only adjusts the size of contentView, so it is still possible to cover the EditText. adjustNothingThe Activity window will not be resized and the contentView will not change size. |
When eating meat during the Chinese New Year, you...
In 2015, everyone started their own business, and...
Hong Raiders Trend Season Hunting Hunting C Stren...
Whether it is a website or an APP, when the numbe...
As functions become increasingly complete, the ba...
"This new product is great, you have to sell...
Watching videos in free time has become an entert...
Course Catalog: ├──00 Electronic version of the b...
The decline of traffic dividends is now an irreve...
It’s been almost a year since the heart-wrenching...
As the saying goes, "a white complexion hide...
Not long ago, Academician He Jie's team publi...
It took nearly two months from the official annou...
[[221521]] The most difficult task for programmer...
Produced by: Science Popularization China Author:...