软键盘调整大小的背景图像上的Andr​​oid [英] Software keyboard resizes background image on Android

查看:141
本文介绍了软键盘调整大小的背景图像上的Andr​​oid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当软件键盘时,它调整大小的背景图像。请参考下面的截图:

正如你所看到的,背景之类的挤压。任何人都可以,为什么后台调整大小洒下的光?

我的布局如下:

 < LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:方向=垂直
    机器人:layout_width =WRAP_CONTENT
    机器人:layout_height =WRAP_CONTENT
    机器人:背景=@可绘制/ page_bg
    机器人:isScrollContainer =假
>
    < LinearLayout中的android:layout_height =WRAP_CONTENT
        机器人:方向=横向
        机器人:layout_width =FILL_PARENT
    >
        < EditText上机器人:ID =@ + ID / CatName
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =WRAP_CONTENT
            机器人:layout_weight =1
            机器人:inputType =textCapSentences
            机器人:行=1
        />
        <按钮机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT
            机器人:文本=@字符串/保存
            机器人:的onClick =saveCat
        />
    < / LinearLayout中>
    <的ImageButton
        机器人:ID =@ + ID / add_totalk
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_width =WRAP_CONTENT
        机器人:背景=@空
        机器人:SRC =@可绘制/ add_small
        机器人:scaleType =中心
        机器人:的onClick =createToTalk
        机器人:layout_marginTop =5DP
    />
< / LinearLayout中>
 

解决方案

好吧我固定它通过使用

安卓windowSoftInputMode =stateVisible | adjustPan

在我的清单文件的活动项目。我认为它是由具有活性的内滚动型引起的。

Whenever the software keyboard appears, it resizes the background image. Refer to the screenshot below:

As you can see, the background is sort of squeezed. Anyone can shed a light on why the background resizes?

My Layout is as follows:

<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>

解决方案

Ok I fixed it by using

android:windowSoftInputMode="stateVisible|adjustPan"

entry in my Activity in manifest file. I think it was caused by having ScrollView inside the Activity.

这篇关于软键盘调整大小的背景图像上的Andr​​oid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆