The solution to the top of the layout when the Android soft keyboard pops up

Source: Internet
Author: User

Original:Solve the Andriod soft keyboard appears to the original layout to top up the method (turn)

Links: http://blog.sina.com.cn/s/blog_9564cb6e0101g2eb.html


method, in Mainfest.xml, for that activity plus:

<activityandroid:name= ". Activity. Homeactivity "android:windowsoftinputmode=" Adjustpan|statehidden"></activity>

Will not put the original activity layout to top up.

%¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥

Today to do a search function, the search interface using Autocompletetextview to do the search bar, and then the following with the ListView to display the search results, and my main interface is at the bottom of the tab to do a main interface navigation, which has a search button, Because in the search bar to enter the text will pop up the software disk, but if you do not make any settings, the soft keyboard pop out at the same time, will be the following tab navigation to the corresponding screen, the interface shows the distortion Ah, and then found a solution, In the corresponding activity (for example, I am tab activity, using Adjustpan) to add

Android:windowsoftinputmode This property, the following details this property:

& X! Q6c9}% I.] 6 @0 Y "n6^ d {" X

The Windowsoftinputmode property sets the value description.

<activityandroid:windowsoftinputmode=["Stateunspecified",

"Stateunchanged", "Statehidden",

"Statealwayshidden", "statevisible",

"Statealwaysvisible", "adjustunspecified",

"Adjustresize", "... >

</activity>

Attributes

Android:windowsoftinputmode

How the active main window interacts with the Soft keyboard window on the containing screen. The setting of this property will affect two things 7s7 u+ S! P7 s (U) N:t: m& n
:

1>
The state of the soft keyboard--whether it is hidden or displayed--when active 5w$ r-u9 i "H. O ' m
(Activity) becomes the focus of the user's attention.

2>
Active main Window adjustment-whether to reduce the active main window size to make room for a soft keyboard or whether the current focus of its content is visible when part of the active window is overwritten by a soft keyboard.

It must be set to a value in the list below, or a
"State ..." value plus one + S. Z "M5 u: {; k; B7v4 Q
A combination of the "adjust ..." values. Set multiple values in either group-multiple
"State ..." values, such as &
The mdash has undefined results. Between each value with +h8 v$ q#-F3 b& '-G8 C $ y
| separate. For example
: <activityandroid:windowsoftinputmode= "Statevisible|adjustresize".. .>

The value in this setting is 8a:n! L ' x0 ': C
(except ' H0 N "G, W2 W) K F # y2 L!c
"Stateunspecified" and
"Adjustunspecified" 3 ^, p2e g:i2 y/v
Overrides the value set in the theme.

Overrides the value set in the theme

Value

Describe

"Stateunspecified"

The state of the soft keyboard
(Whether it is hidden or visible
) is not specified. The system will select an appropriate state or a theme-dependent setting. This is the default setting for the software disk behavior.

"Stateunchanged"

The soft keyboard is persisted regardless of its last state, whether visible or hidden, when the main window appears in front.

"Statehidden"

When the user selects the
During activity, the soft keyboard is hidden-that is, when the user determines to navigate to the # ^* {1 W. c:y-}
Activity when instead of returning to it due to leaving another:}/N! P (A * M% W. B%m9 b# U
Activity.

"Statealwayshidden"

The soft keyboard is always hidden when the
When the Activity main window gets focus.

"Statevisible"

The soft keyboard is visible when that is normal and appropriate & d% g.y8 [; G _: V
(When the user navigates to "S2 i/j$ S2 W7 J) j6o& J, F
When the Activity main window
)。

"Statealwaysvisible"

When the user chooses this 6 z%c e/r0 u,m ' 7N r
During activity, the soft keyboard is visible-that is, when the user determines to navigate to that. M R6 r% T. ' # A4 c0^, T; D! V
Activity when instead of returning to it due to leaving another
Activity.

"Adjustunspecified"

It is not specified whether the "H9 b! V3 h5_& o$ d$ M B "v5j:d
The Activity main window resizes to allow space on the soft keyboard, or whether the contents of the window are visible on the screen with the current focus. The system will automatically select one of these modes primarily depending on whether the contents of the window have any layout view that can scroll their content. If there is such a view, the window will be resized so that the contents of the scrolling window can be visible in a smaller area. This is the default behavior setting for the main window.

"Adjustresize"

The/M "r:m-W (Z. Q6 d*a
The Activity main window is always resized on the screen to allow space for the soft keyboard

"Adjustpan"

The
The Activity main window does not adjust the size of the screen to allow space for the soft keyboard. Instead, the contents of the current window are automatically moved so that the current focus is never covered by the keyboard and the user can always see the part of the input. This is usually not expected than resizing, because the user may turn off the soft keyboard in order to get an interactive operation with the covered content.

20131218 Reading

This problem has plagued me for a long time, and today I see the above article to solve it. Thank bloggers for sharing.

20131218 End

      • Previous Ubuntu under Apt-get with the "Waiting for the header"
      • An introduction to the next design pattern

The solution to the top of the layout when the Android soft keyboard pops up

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.