我正在开发一个应用程序,其中背景图像在弹出键盘时缩小。我的 .xml 如下:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:facebook="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
/**
Other stuff
*/
</RelativeLayout>
</ScrollView>
</RelativeLayout>
我在谷歌上搜索发现,添加
android:windowSoftInputMode="stateVisible|adjustPan"
在我的清单文件中。但它没有用。
Edit :
弹出键盘之前我的布局如下所示:
弹出后如下:
请检查背景图像的差异。在图像 1 中,图像的尺寸是固定的,而在图像 2 中,背景图像是缩小的。我需要页脚和背景在键盘弹出窗口上向上移动。
我遗漏或做错了什么,请建议我。
只需在您的onCreate()
这段代码:
protected void onCreate(Bundle savedInstanceState) {
...
getWindow().setBackgroundDrawableResource(R.drawable.your_image_resource);
...
}
并删除 xml 中的这一行:
android:background="@drawable/background"
阅读更多内容:
http://developer.android.com/reference/android/view/Window.html http://developer.android.com/reference/android/view/Window.html
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)