键盘出现时,Android EditText不完全可见

时间:2017-05-05 06:58:59

标签: android android-layout android-edittext

当键盘出现时,我的EditText不完全可见,直到焦点才可见,但是有可能查看完整的EditText。

enter image description here

布局

<ScrollView
        android:id="@+id/scrollvew_direct"
        android:isScrollContainer="true"
        android:layout_height="wrap_content">
    <EditText
         android:id="@+id/edt_employers_name"
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:layout_marginTop="20dp"
            android:layout_centerHorizontal="true"
            android:inputType="text"
            android:maxLength="100"
            android:hint="@string/dir_deposit_6"
            android:textSize="@dimen/edittextsize_sub"
            android:gravity="center"
            android:layout_gravity="center"
            android:textColor="@color/main_header"
            android:textColorHint="@color/hint_color_light"
            android:background="@drawable/edittext_style"/>
     </ScrollView>

在mainfest中

<activity
android:name=".activityname"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"
android:theme="@android:style/Theme.Holo.Light.NoActionBar"/>

请指导我做出正确的解决方案。

2 个答案:

答案 0 :(得分:1)

在清单的活动标签中,添加此属性

android:windowSoftInputMode="stateAlwaysHidden|adjustResize"

答案 1 :(得分:1)

在清单的活动标签中,添加此属性

android:windowSoftInputMode="adjustResize"

已修改:  Edittext高度与背景可绘制

不完全匹配

将edittext设为

android:layout_height="match_parent" or
android:layout_height="wrap_content"

并检查它是否正常工作

相关问题