键盘消失时的Android白色背景

标签 android angularjs ionic-framework

来自不同用户的问题视频,但相同

http://imgur.com/ca2cNZv

我的背景图片设置如下:

  .pane {
  background-image:  url("../img/inner-banner-bg.jpg");
  background-repeat: repeat;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  background-size: cover;
}

在我的 config.xml 中

<preference name="Fullscreen" value="false"/>

现在我遇到的问题是当我点击完成/搜索后键盘消失时,它在键盘覆盖的空间过渡期间留下了大约 0.5 的白色背景,看起来有点糟糕。

当键盘关闭时,它不会收缩,但会留下空白。如何让键盘不缩小背景后面的 View ?

当我设置时

<preference name="Fullscreen" value="true"/>

这不会发生。我也在使用 Ionic 插件键盘。

无论如何我可以让键盘淡入淡出的过渡不显示白色背景?

编辑:这是我的安卓设置

<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
            <intent-filter android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

还有我的配置设置

  <access launch-external="yes" origin="geo:*"/>
  <allow-intent href="geo:*"/>
  <preference name="webviewbounce" value="false"/>
  <preference name="UIWebViewBounce" value="false"/>
  <preference name="DisallowOverscroll" value="true"/>
  <preference name="android-minSdkVersion" value="16"/>
  <preference name="BackupWebStorage" value="none"/>
  <preference name="SplashScreen" value="screen"/>
  <preference name="SplashScreenDelay" value="4000"/>
  <preference name="FadeSplashScreen" value="false"/>
  <preference name="ShowSplashScreenSpinner" value="true"/>
  <preference name="KeyboardShrinksView" value="false"/>

在 Package.json 中

  "dependencies": {
    "gulp": "^3.5.6",
    "gulp-sass": "^2.0.4",
    "gulp-concat": "^2.2.0",
    "gulp-minify-css": "^0.3.0",
    "gulp-rename": "^1.2.0"
  },
  "devDependencies": {
    "bower": "^1.3.3",
    "gulp-util": "^2.2.14",
    "shelljs": "^0.3.0"
  },
  "cordovaPlugins": [
    "cordova-plugin-device",
    "cordova-plugin-console",
    "cordova-plugin-whitelist",
    "cordova-plugin-splashscreen",
    "cordova-plugin-statusbar",
    "cordova-plugin-geolocation",
    "cordova-plugin-network-information",
    "ionic-plugin-keyboard"
  ],
  "cordovaPlatforms": [
    "android",
    "ios"
  ]

在我的 WebView 中,我使用 ion-view 和 ion-content

<ion-view>
    <ion-content class="has-header has-tabs">

最佳答案

在 AndroidManifest.xml 文件中尝试将 windowSoftInputMode 属性设置为 adjustNothing :

android:windowSoftInputMode="adjustNothing"

它适用于我的 Ionic 项目,避免在打开软键盘时调整 Cordova webview 的大小。

关于键盘消失时的Android白色背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35201412/

相关文章:

android - Html.fromHtml 中的换行符被忽略

android - PhoneGap - Android 上的 Cordova 2.1 地理定位不一致

javascript - 单元测试 Angular + Browserify + Gulp 和 Jasmine

javascript - 如何检查表达式中元素的可见性?

ios - 我可以在 Windows 上使用 ionic 进行 IOS 开发吗?

android - react native : JAVA_HOME is not set and no 'java' command could be found in your PATH

android - 拦截 MediaController 的关键事件?

javascript - 默认值不是?选择选项 Angularjs 中的对象 :null ?

ionic-framework - 类型 'iOSExternalAccessory' 上不存在属性 'CordovaPlugins'

android - 是否可以在 ionic 启动之前更改 ionic 包名称?