AdjustPan不阻止键盘覆盖EditText

我正在尝试创建一个非常基本的聊天屏幕,其中的ListView在底部显示文本,EditText,并在EditText的右侧显示“发送”按钮。一切正常,但是当我单击EditText时,虚拟键盘将其覆盖。屏幕略微平移,但不足以在键盘上方可见。我的清单中有“ adjustPan”标签,也尝试了“ adjustResize”标签无济于事。我猜想这与我的布局设置方式有关,但老实说我没有任何线索。请帮忙!


当前布局...


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:orientation="vertical"

android:layout_width="fill_parent"

android:layout_height="fill_parent">


<ListView android:id="@+id/android:list" 

    android:layout_height="0dip" 

    android:layout_width="fill_parent"

    android:layout_weight="1"

    android:stackFromBottom="true">

</ListView>


<LinearLayout android:orientation="horizontal"

    android:layout_width="fill_parent"

    android:layout_height="wrap_content">


    <EditText android:id="@+id/sendMessageBox"

        android:focusable="true"

        android:layout_width="fill_parent"

        android:layout_height="wrap_content"

        android:layout_weight="1"

        android:scrollbars="vertical"

        android:maxLines="4"

        android:text=""

        android:inputType="textShortMessage|textAutoCorrect|textCapSentences|textMultiLine"

        android:maxLength="1000"

        android:hint="Type your message..."

        android:imeOptions="actionSend"/>


    <Button android:id="@+id/sendMessageButton" 

        android:layout_width="wrap_content" 

        android:layout_height="wrap_content"

        android:layout_gravity="bottom"

        android:text="Send"/>


</LinearLayout>


呼啦一阵风
浏览 328回答 3
3回答

汪汪一只猫

经过大量搜索之后,这就是我所说的错误。如果使用全屏标记(要从活动中删除状态栏),则不将活动包装在ScrollView中就不能使用“ adjustResize”。不幸的是,我正在使用ListView,这会带来另一个问题。我讨厌把它弄乱了,可能会放弃该活动的全屏显示。

郎朗坤

如果您android:windowSoftInputMode="adjustResize" 在清单中设置了活动,则ScrollView(或其他可折叠的ViewGroup)将缩小以容纳软键盘。但是,如果您android:windowFullscreen="true"在活动的主题中进行设置,则ScrollView不会缩小,因为它被迫填满整个屏幕。但是,android:fitsSystemWindows="false"在主题中设置也会导致AdjustResize不起作用
打开App,查看更多内容
随时随地看视频慕课网APP