Android soft keyboard pop-up layout issues

Source: Internet
Author: User

The recent project needs to do a similar chat room module, based on the socket implementation, this part of the time to do a summary later, the function of the relevant points are implemented a small example also made, and finally found a more griping at everything problem is that the soft keyboard pop-up will always be the title "Extrusion" screen, (whether the title is written in the layout or added to the style in the same way as theme), the input is lost when viewed as:

Faint feeling before the project has been a similar problem, but generally only in the landing interface, harmless, user input after a sweep, can be ignored, but this page processing is really not very beautiful.

Check out this kind of problem roughly two ways to solve:

First, adjust the layout at the bottom using the ScrollView component, will need to fix the layout (title) written outside the ScrollView.

Second, set the Activity property in the manifest configuration file.

The first method has not been tried, the feasibility of the final, the following main next:

Activity main window and soft keyboard interaction mode, can be used to avoid the Input Panel occlusion problem, there is a property set Android:windowsoftinputmode, this belongs to the performance of two things:

1, when the focus is generated, the soft keyboard is hidden or displayed

2. Reduce the size of the active main window to make room for the soft keyboard

It must be set to a value in the list below, or a "state ..." value plus a combination of "adjust ..." values. Set multiple values in either group-multiple "state ..." values, such as &mdash, have undefined results. Each value is separated by | For example:

<activity android:windowsoftinputmode= "Statevisible|adjustresize" ... >

The value set in this (except "stateunspecified" and "adjustunspecified") overrides the value set in the topic

Meaning of each value:

Stateunspecified: The state of the soft keyboard is not specified and the system will select an appropriate state or a theme-dependent setting

Stateunchanged: When this activity appears, the soft keyboard will remain in the previous activity, whether it is hidden or displayed

Statehidden: The soft keyboard is always hidden when the user chooses activity

Statealwayshidden: When the Activity main window gets focus, the soft keyboard is always hidden

Statevisible: Soft keyboard is usually visible

Statealwaysvisible: The soft keyboard always displays the status when the user chooses activity

Adjustunspecified: Default setting, which is usually determined by the system to hide or show itself

Adjustresize: The activity always resizes the screen to allow space on the soft keyboard (all screens can be displayed)

Adjustpan: The contents of the current window will automatically move so that the current focus is never covered by the keyboard and the user can always see the part of the input (the soft keyboard masks the screen)

Here are two of the properties:

1.adjustResize This is also want to achieve the effect

2.adjustPan, this attribute is biased to focus on a soft keyboard

Android soft keyboard pop-up layout issues

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.