android - adjustPan 不阻止键盘覆盖 EditText

标签 android android-layout android-manifest android-softkeyboard

我正在尝试创建一个非常基本的聊天屏幕,其中包含显示文本的 ListView 和底部的 EditText,以及 EditText 右侧的“发送”按钮。一切正常,但是当我单击 EditText 时,虚拟键盘会覆盖它。屏幕稍微向上平移,但不足以在键盘上方可见。我的 list 中有“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>

最佳答案

经过大量搜索,显然这就是我所说的错误。如果您使用全屏标签(从 Activity 中删除状态栏),则不能在不将 Activity 包装在 ScrollView 中的情况下使用“adjustResize”。对我来说不幸的是,我正在使用 ListView,这会产生另一个问题。我厌倦了它,可能会放弃该 Activity 的全屏。

关于android - adjustPan 不阻止键盘覆盖 EditText,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4558810/

相关文章:

android - 将多个 View 添加到 ViewPager 中的连续页面

java - Android Studio 2.2.3 Base.Theme.AppCompat 错误

java - Android - 使用自定义按钮的自定义 View 使整个屏幕都可以点击,而不仅仅是在按钮区域

安卓方向和键盘问题

android - 如何在android中动态更新或更改imageview的图像?

android - android manifest 中的哪些标签可以限制应用程序仅适用于 Playstore 上的手机?

android - 强制应用程序如何始终运行在自己的任务中?

android - Android repo list 存储库如何工作?

java - 世博会弹出的应用程序因 java.net.ConnectException 崩溃

android - AVD 模拟器浏览器不会使用主机文件