Android Soft keyboard pops up the bottom bar to the top without squeezing the interface

Source: Internet
Author: User

Interface needs, found a need not to set the Android:windowsoftinputmode property to solve the keyboard and layout discomfort problems

Information about setting up Android:windowsoftinputmode can be self-Baidu.

My approach is to set the root layout of the XML file to ScrollView, nesting the previous layout in it, without having to set any of these properties

In the middle where no control is displayed, use the view settings weight to occupy the position

The following gives my XML layout

<ScrollViewxmlns:android= "Http://schemas.android.com/apk/res/android"Xmlns:tools= "Http://schemas.android.com/tools"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"Android:fillviewport= "true"Tools:context= "Com.example.richedit.TestInputMethodActivity" >    <LinearLayoutAndroid:layout_width= "Fill_parent"Android:layout_height= "Fill_parent"android:orientation= "vertical">        <LinearLayoutAndroid:layout_width= "Fill_parent"Android:layout_height= "40DP"Android:background= "#332423">                    </LinearLayout>        <ViewAndroid:layout_width= "Match_parent"Android:layout_height= "0DP"Android:layout_weight= "1"/>        <EditTextAndroid:layout_width= "Match_parent"Android:layout_height= "Wrap_content"/>        <EditTextAndroid:layout_width= "Match_parent"Android:layout_height= "Wrap_content"/>        <ViewAndroid:layout_width= "Match_parent"Android:layout_height= "0DP"Android:layout_weight= "1"/>        <RelativelayoutAndroid:layout_width= "Fill_parent"Android:layout_height= "54dip"Android:background= "@android:d rawable/bottom_bar">            <ButtonAndroid:id= "@+id/manual_setup"Android:text= "Zuozuo"Android:layout_height= "Wrap_content"Android:layout_width= "Wrap_content"Android:minwidth= "100DP"Android:layout_alignparentleft= "true"android:layout_centervertical= "true" />              <ButtonAndroid:id= "@+id/next"Android:text= "Youyou"Android:layout_height= "Wrap_content"Android:layout_width= "Wrap_content"Android:minwidth= "100DP"Android:layout_alignparentright= "true"android:layout_centervertical= "true" />          </Relativelayout>    </LinearLayout></ScrollView>

This gives the Keyb pop-up and does not pop up, very good to the bottom bar top up

Android Soft keyboard pops up the bottom bar to the top without squeezing the interface

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.