Android keypad does not affect Layout

Source: Internet
Author: User

[Reprint] http://geyubin.iteye.com/blog/1297637

Based on the original instructions in the original document, the translation is revised to facilitate reading and understanding.

Attributes:

Android: windowsoftinputmode

How the activity interacts with the keyboard. The setting of this attribute affects two things:

  1. Keyboard status-hide or display-When activity becomes the focus of user attention.

  2. Activity layout adjustment-whether the activity layout is smaller to free up space for the software disk, or whether the content of the activity layout is translated when it is covered by a soft keyboard to ensure that the current focus is visible.

It must be set to a value in the following list or a "state ..." Add "Adjust…" to the value ..." Value combination.

Set multiple values in any group-multiple "states ..." Value. Use | to separate values.

Example: <activity Android: windowsoftinputmode = "statevisible | adjustresize"...>

The value set here (except "stateunspecified" and "adjustunspecified") will overwrite the value set in the topic

Description:

----------------------------------------------- State prefix ----------------------------------------------------------------------

  • The "stateunspecified" keypad status (whether it is hidden or visible) is not specified. The system selects an appropriate status or topic-dependent setting. This is the default settings for the keyboard.

 

  • "Stateunchanged" when the main window appears in front, it will be maintained regardless of the last soft keyboard status.

  • "Statehidden" when the user selects the activity, the soft keyboard is hidden, that is, when the user is sure to navigate to the activity, instead of returning it from another activity.

  • "Statealwayshidden" the keyboard is always hidden when the activity Main Window gets the focus.

  • "Statevisible" when appropriate (that is, when you navigate to the activity main window), the soft keyboard is visible,

  • "Statealwaysvisible" when you select this activity, the soft keyboard is visible-that is, when the user is sure to navigate to this activity, instead of returning it from another activity.

------------------------------------------------- Adjust prefix -------------------------------------------------------------------

  • "Adjustunspecified" is not sure whether to adjust the size of the Main Window of the activity to leave space for the software disk. Or whether the content in the window is moved to ensure that the current focus is visible. The system automatically selects one of these modes, depending on whether the content of the window has any layout view that can scroll their content. If there is such a view, assuming that scrolling can make all the content of the window visible in a small area, the window will be adjusted. This is the default behavior settings for the main window.

  • "Adjustresize" the activity is always adjusted to the layout size to leave space for the keyboard. We recommend that you use this attribute. For example, scrollview will scroll to display the view that gets the focus.

  • "Adjustpan" does not adjust the layout, but moves the hidden parts of the keyboard to the displayed status for interaction. Such settings usually pin the custom title to the outside of the screen. Poor results. This attribute is not recommended.

 

 

 

Turn off the Bi soft keyboard:

Inputmethodmanager M = (inputmethodmanager) mcontext. getsystemservice (context. input_method_service );

M. hidesoftinputfromwindow (mcontentet. getwindowtoken (), 0 );

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.