简体   繁体   English

Android 4.0软键盘与EditText重叠

[英]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. 找不到解决方案,如何避免位于主窗口底部ScrollView下的EditText弹出SoftKeyboard出现重叠。 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. 我添加了android:descendantFocusability =“ beforeDescendants” android:focusableInTouchMode =“ true”和android:focusable =“ true” android:focusableInTouchMode =“ true”-并没有帮助。

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. 已解决低于4.0(2.2、2.3和3.2)的Android的问题,但尚未解决Android 4.0及更高版本的问题。

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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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