【问题标题】:Position EditText above softwarekeyboard delay将 EditText 置于软件键盘延迟上方
【发布时间】:2016-02-04 21:25:23
【问题描述】:

我有一个编辑文本,它在打开时成功定位在软件键盘上方。问题是当键盘打开时,键盘是可见的,大约 2 秒后,edittext 被定位。我如何使在键盘打开之前显示在页面底部的编辑文本在键盘向上时进行动画处理?

【问题讨论】:

    标签: android keyboard android-edittext window-soft-input-mode


    【解决方案1】:

    在 Edittext 的父容器中使用 ScrollView

    <ScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent">
        <LinearLayout
                android:layout_width="match_parent" 
                android:layout_height="match_parent">
            <EditText 
                    android:layout_width="match_parent" 
                    android:layout_height="match_parent"/>
        </LinearLayout>
    
    </ScrollView>
    

    并将其添加到您在 AndroidManifest 中的活动

    android:configChanges="keyboardHidden|orientation|screenSize"
    android:windowSoftInputMode="stateHidden|adjustResize"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-02-20
      • 1970-01-01
      • 1970-01-01
      • 2011-10-17
      • 2014-10-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多