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. |
Hemorrhoids, it's a bit hard to talk about Th...
How much does it cost to produce the Zhuhai ticke...
A copywriter is a salesperson who sits behind a k...
Millions of animals around the world follow the s...
Weibo is a platform with very high user activity,...
"Predict, Sense, Respond: Government Interne...
In almost every harbor, we can see a strange kind...
There is a kind of fruit that “people who love it...
Why do the giants all want to make short videos? ...
Experts in this article: Yu Tong, Associate Chief...
Compared with APP, WeChat’s significant advantage...
Today, I will summarize some methods of online ac...
Yesterday, a magical advertisement appeared on We...
According to the data from the National Bureau of...
In order to ensure that every consumer with deman...