gpt4 book ai didi

Android - 键盘压缩我的 View

转载 作者:行者123 更新时间:2023-11-29 15:14:37 24 4
gpt4 key购买 nike

我正在开发 Android/iOS 应用程序。当键盘打开用于登录(用户名和密码)时,所有内容都缩小到一起,看起来像这样:

enter image description here

通常它不应该被压缩。它应该向上移动,让我清楚地了解我正在输入的内容。

enter image description here

是的,所以我不知道该怎么办。我尝试在整个应用程序(宽度/高度)中使用百分比 - 也许这就是为什么我的 View 没有向上移动但缩小的原因?

我在堆栈中环顾四周,发现了一些建议,例如:

<activity
...
android:windowSoftInputMode="adjustPan">
</activity>

adjustResize 代替,但这些对我都不起作用。在 iOS 上一切正常。我想让 View 做的是他只是向上移动了一点,并且没有调整任何大小。

我希望你能帮助我,如果你需要更多信息,请告诉我,我会更新或评论我的问题。

  • Cordova 3.5
  • jQuery/jQuery-Mobile
  • 插件:相机/控制台/设备/对话框/文件传输/文件/inappbrowser/Splashscreen/Statusbar/vibration/geolocation/network-information
  • 使用 Genymotion 模拟器进行 Eclipse
  • 设备:Galaxy Note 10.1、4.4.2; Xperia Z2 4.4.2

这是我的 Androidmanifest 的样子:

<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="1.0" package="de.*****************.de" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:screenOrientation="portrait" android:label="@string/activity_name" android:launchMode="singleTop" android:name="********" android:theme="@android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustPan">
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="17" android:targetSdkVersion="20" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.VIBRATE" />
</manifest>

最佳答案

几天前,我遇到了同样的问题。

正如您所说,您已经以百分比形式给出了高度和宽度。

当 android 键盘出现时,窗口会调整大小,其高度为屏幕尺寸,不包括键盘尺寸。

将高度指定给页面的主容器(即 body 标签)将在键盘出现时缩小页面的高度,

document.ready 上为 body 标签设置一次最小高度对我有用。

$(function(){

$("body").css("min-height",$(window).height())

});

关于Android - 键盘压缩我的 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25934141/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com