每当软件键盘出现时,它都会调整背景图像的大小.请参阅下面的屏幕截图:

正如你所见,背景有点压缩.任何人都可以解释为什么背景会变大?

我的布局如下:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/page_bg"
    android:isScrollContainer="false"
>
    <LinearLayout android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_width="fill_parent"
    >
        <EditText android:id="@+id/CatName"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:inputType="textCapSentences"
            android:lines="1"
        />
        <Button android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/save"
            android:onClick="saveCat"
        />
    </LinearLayout>
    <ImageButton
        android:id="@+id/add_totalk"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:background="@null"
        android:src="@drawable/add_small"
        android:scaleType="center"
        android:onClick="createToTalk"
        android:layout_marginTop="5dp"
    />
</LinearLayout>

推荐答案

好的,我用

android:windowSoftInputMode="stateVisible|adjustPan"

manifest文件中<Activity >个标记内的条目.我想这是因为活动中有ScrollView造成的.

Android相关问答推荐

Kotlin中的类型参数不在其范围内

Android Google Select 帐户总是会产生结果代码0

如何在Jetpack Compose中使用Box Composable来实现这种布局?

Android 14上的慢速意图广播交付

如何共享没有';t是否存在?(仅信息)在Android?

Android 中 recyclerview 的自定义分隔线 colored颜色 不起作用

错误:参数的类型必须是用@Entity注释的类或其集合/array. java.lang.String tocd);

无法插入 LayoutNode@cc72396 子级,因为它已有父级

根据另一个数组的值对数组进行排序

如何以编程方式通过 whatsapp android 共享图像和文本

来自位图的 WearOS 图标不显示 colored颜色

在 Jetpack Compose 中包装内容

PayUCheckoutPro Android SDK 实现问题

可组合的可见性不随状态变化而变化

Jetpack compose 未解决的参考错误

如何将设备屏幕位置转换为发送事件位置?

Android Compose 创建抖动动画

如何处理 com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: For input string: "T1V 4Y8" Kotlin

如何从我的 android 应用程序中删除 QUERY_ALL_PACKAGES 权限?

当我更改 ViewModel var 时,Kotlin + Compose 中的 Composable 不会更新