Solution to the Problem of input method occlusion on the Android platform
In the Android system, due to the limitation of the phone screen size, the pop-up input method panel usually occupies most of the screen when character input is required. If the input box is just below, it is often the embarrassment of being blocked by the input method panel, which brings great troubles to users and unfriendly user experience.
Check the android SDK instructions and find that you can solve this problem by setting an attribute of the activity. For example, you can write in androidmanifest. XML as follows:
<Activity Android: Name = ". categorylist"
Android: Label = "@ string/app_name"
Android: windowsoftinputmode = "statevisible | adjustpan">
</Activity>
Here, Android: windowsoftinputmode is used to avoid the problem of blocking the input method panel. For specific parameter descriptions, see the SDK documentation. However, it indicates that this attribute is added after Android 1.5, that is, the SDK after API Level 3 is supported. What should I do if I don't use it on machines like Lenovo O1? Fortunately, I found another solution, scrollview. We can add a scrollview to the top-level element of the corresponding layout XML. In this way, all text boxes will automatically scroll up when the input method panel is popped up. The sample code is as follows:
<Scrollview xmlns: Android = "http://schemas.android.com/apk/res/android"
Android: layout_width = "fill_parent"
Android: layout_height = "fill_parent">
<Linearlayout Android: Orientation = "vertical"
Android: layout_width = "fill_parent"
Android: layout_height = "fill_parent">
<Edittext Android: Id = "@ + ID/content"
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: lines = "4"
Android: scrollbars = "vertical"
Android: gravity = "fill_horizontal"/>
</Linearlayout>
</Scrollview>