EditText保留在某些android设备的键盘后面



我在android应用程序中使用了一个包含多个EditText的列表视图。用于manifest.xml

android:windowSoftInputMode="adjustPan"

和java代码:

et_email.setOnFocusChangeListener(new CustomOnFocusChangeListener());
private class CustomOnFocusChangeListener implements OnFocusChangeListener {
    @Override
    public void onFocusChange(View v, boolean hasFocus) {
        if (hasFocus) {
            getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
        }           
    }
}

所以失焦问题得到了解决。但我遇到了这样一个问题:EditText保留在三星galaxy s3和note 10.1平板电脑的android设备4.1.2版本的键盘后面。另一台安卓4.1.2版和安卓4.3版galaxy s3的设备没有问题。我尽力了,但没能解决这个问题。

编辑:这是屏幕布局:

 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:tools="http://schemas.android.com/tools"
 android:background="@color/White"
 android:layout_width="match_parent"
 android:layout_height="match_parent">
    <LinearLayout
    android:id="@+id/ll_passengersInfoScreen"    
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >
<ListView
  android:id="@+id/lv_details”   
  android:layout_width="match_parent"
   android:layout_height="match_parent">
</ListView>
 <TextView
   style="@style/TextViewWhiteBoldLargeSize"
   android:layout_width="match_parent"
   android:padding="@dimen/padding_medium"
   android:text="@string/Guest_Info"/>
<ListView
  android:id="@+id/lv_passenger"   
  android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:dividerHeight="1dp"
   android:divider="@color/Black">
</ListView>

     <LinearLayout 
     android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:baselineAligned="false"
   android:orientation="horizontal">
    <!— several view more -!>          
    </LinearLayout>
  </LinearLayout> </ScrollView>

将文本编辑到"lv_passenger"列表视图行中。我动态计算listView的高度。

是的,我也面临同样的问题。。。

我不得不将根ViewGroup更改为ScrollView,然后从清单文件中删除"adjustPan"。

在您的情况下,您需要从清单中删除"adjustPan",并尝试将焦点放在触摸项目上。

希望它能帮助你解决你的问题。

最新更新