EditText设置了InputType后弹出软键盘会被遮挡

设置了一个EditText,放置在靠近屏幕底部,设置了InputType属性后,点击了EditText,弹起软键盘,这时候EditText会跟随软键盘上升,这时再次手动隐藏软键盘,然后再次点击EditText,软键盘弹出后就遮挡了EditText。
InputType去掉后就会一直跟随软键盘上升从而不会遮挡

<android.support.v7.widget.AppCompatEditText
            android:id="@+id/login_pwd_et"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="13dp"
            android:layout_marginRight="13dp"
            android:layout_marginTop="15dp"
            android:gravity="center"
            android:hint="请输入密码"
            android:inputType="textPassword"<!--去掉这个就会跟随软键盘-->
            android:textColorHint="@color/colorTextLight"
            android:textSize="15sp" />

怎样让EditText一直跟随软键盘?android:windowSoftInputMode="adjustPan"这个我也尝试设置了,也不行

阅读 5.3k
2 个回答

gravity和inputtype同时使用在5.0以下有类似问题,还用password属性

android:windowSoftInputMode="adjustResize"

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题