软键盘在 Android 上调整背景图像的大小 [英] Software keyboard resizes background image on Android
本文介绍了软键盘在 Android 上调整背景图像的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
每当软键盘出现时,它都会调整背景图像的大小.请参考以下截图:
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?
我的布局如下:
<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
文件中的
entry inside <Activity >
tag in manifest
file. I think it was caused by having ScrollView inside the Activity.
这篇关于软键盘在 Android 上调整背景图像的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文