简体   繁体   中英

Android 4.0 softkeyboard overlaps EditText

Couldn't find solution how to avoid overlapping by popup SoftKeyboard of my EditText situated in the bottom of main window, just under ScrollView. I made a day of looking for solution here, but all the advices:

I added android:descendantFocusability="beforeDescendants" android:focusableInTouchMode="true" and android:focusable="true" android:focusableInTouchMode="true" - that didn't help.

Ajusting manifest:

<activity
    android:name=".mvc.views.SightingDetailsActivity"
    android:theme="@android:style/Theme.Black"
    android:screenOrientation="portrait"
    android:windowSoftInputMode="stateHidden|adjustPan"
    />

has solved the issue for Android lower than 4.0 (2.2, 2.3 and 3.2) but hasn't solved the problem for Android 4.0 and greater.

use scroll View as a parent and put the other layout component as
a child inside this scroll View.

  <?xml version="1.0" encoding="utf-8"?>
  <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:paddingLeft="30dp"
  android:paddingRight="30dp"
  android:layout_height="match_parent">
 <TableLayout
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:shrinkColumns="*" 
   android:stretchColumns="*" 
   android:focusableInTouchMode="true">
    <TableRow
         android:layout_width="match_parent"
         android:padding="20dp"
         android:layout_height="wrap_content">
       <TextView
           android:text="@string/introduction"
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:textSize="27dp"
           android:textColor="@color/green"
           android:layout_span="4"
           android:gravity="center_horizontal"/>
  </TableRow>
    <TableRow
          android:layout_width="match_parent"
          android:layout_height="1dp"
          android:background="@color/green">
       <TextView android:layout_span="2" 
           android:layout_height="1dp" 
           android:layout_width="match_parent"
           android:text="">
       </TextView>
      </TableRow>
    </ScrollView>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM