tianxiayuxin
tianxiayuxin

Reputation: 1

EditText with a top/bottom layou_margin has been covered by the softinput

I have a editbox that contains a edittext and a button in a LinearLayout, just as below:

 <LinearLayout
            android:id="@+id/et_bottom"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#e5e5e5"
            android:gravity="center_vertical"
            android:orientation="horizontal" 
           >

            <EditText
                android:id="@+id/write_comment"
                android:layout_width="0dp"
                android:layout_height="30.5dp"
                android:layout_marginBottom="10.5dp"
                android:layout_marginLeft="5.5dp"
                android:layout_marginTop="10.5dp"
                android:layout_weight="2.0"
                android:background="@drawable/input_box_03"
                android:hint="@string/saysomething"
                android:paddingLeft="5dp"
                android:textColorHint="@color/font_gray"
                android:textSize="@dimen/login_edittext_font_size" />

            <TextView
                android:id="@+id/send_comment"
                android:layout_width="52dp"
                android:layout_height="29.5dp"
                android:layout_marginLeft="8.5dp"
                android:layout_marginRight="5.5dp"
                android:background="@drawable/box"
                android:clickable="true"
                android:focusable="true"
                android:focusableInTouchMode="true"
                android:gravity="center"
                android:text="@string/send"
                android:textColor="@color/font_color_white" />
   </LinearLayout>

The LineraLayout is in a RelativeLayout that matches the windowScreen size and I set the WindowInputSoftMode = "adjustResize", However, when the soft keyboard is shown , the bottom of the LinearLayout is partially covered by the soft keyboard. I don't why and how?

Upvotes: 0

Views: 302

Answers (2)

tianxiayuxin
tianxiayuxin

Reputation: 1

I hava found the problem is about the FullScreen settings for the window through getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FILL_FULLSCREEN);. When it is set, the keyboard must pop the content of the layout to a higher position and the head of the keyboard must attach to the cursor's bottom.

More specifically, when the second parameter is set for FILL_PARENT, there are no problems. If you don't want to pop the content of the layout, just use a FrameLayout and set the windowInputSoftMode ="adjustResize".

Upvotes: 0

user4728480
user4728480

Reputation:

try using

android:windowSoftInputMode="stateVisible|adjustResize"

Upvotes: 0

Related Questions