小编Pra*_*ysa的帖子

软键盘进来时如何保持某些组件固定?

我的应用程序是一个聊天应用程序,它的 UI 是:

应用程序的标题
列表视图
聊天消息、输入框和发送按钮

但问题是当我单击编辑文本时,软键盘会出现并将所有内容向上推,但我需要标题留在屏幕上。我已经把它贴简化问题的图像和UI代码这里。(我不能在这篇文章中发布多个链接或图片,因为我是 Stack Overflow 的新手。)

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:orientation="vertical">
    <TextView android:text="Header contents" android:layout_width="fill_parent"
        android:textSize="20sp" android:gravity="center_horizontal"
        android:layout_height="wrap_content" />
    <ListView android:id="@android:id/list" android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:layout_weight="1" />

    <EditText android:text="" android:layout_gravity="bottom"
        android:id="@+id/EditText01" android:layout_width="fill_parent"
        android:layout_height="wrap_content"></EditText>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

Android 在默认消息应用程序中有此要求。

有没有人有任何想法?

layout android

7
推荐指数
1
解决办法
5348
查看次数

标签 统计

android ×1

layout ×1