zoukankan      html  css  js  c++  java
  • ionic项目中 软键盘弹出之后的问题:

    Android SDK目前提供的软键盘弹出模式接口只有两种:

        一是弹出时自动回冲界面,将所有元素上顶;
        一种则是不重绘界面,直接将控件元素遮住;
     
     
    1. ionic 中弹出键盘遮挡住输入框(覆盖住页面的内容):
      需要在ionic platform add android 添加平台之后,在生成的AndroidManifest.xml文件中找到以下代码:
    <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
    ="adjustPan|stateHidden"> <intent-filter android:label="@string/launcher_name"> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>

    其中的设置为:android:windowSoftInputMode="adjustPan|stateHidden" --软键盘就可以将内容覆盖了,而不是顶将所有内容顶上去;

    此时如果底部有输入框,聚焦的时候,弹出将会遮挡住输入的内容,不方便查看,所以还要在$ionicPlatform.ready中设置:

    ionic.Platform.isFullScreen = true

    djustResize为Ionic推荐设置,但是如果处于一些原因你使用了adjustPan,那么你需要设置ionic.Platform.isFullScreen = true;
    <activity android:windowSoftInputMode="adjustResize">
     
     
    2. 软键盘弹出后,将页面图片的高度压缩问题:(我的登录页面是用了一整张图片)
     
    AndroidManifest.xml文件中界面对应的<activity>里加入
    android:windowSoftInputMode="adjustPan"   键盘就会覆盖屏幕
    android:windowSoftInputMode="stateVisible|adjustResize"   屏幕整体上移
    android:windowSoftInputMode="adjustPan|stateHidden" 软键盘弹出,界面布局不变,这是解决弹出软键盘,界面整体被压缩的方式
     
     
  • 相关阅读:
    LaunchScreen.storyboard 换了图片 不能更改过来 解决方案
    iOS Google 地图 集成详解
    Mac下 使用git clone 代码慢解决方案
    iOS 函数式编程
    iOS [self class] 、 [self superclass]、 [super class] 、[super superclass] 几种情况对比
    iOS 链式编程-Block 作为放回值
    iOS block的变量捕获(capture)
    iOS Block本质探究
    iOS 读写操作 处理 pthread_rwlock dispatch_barrier_async
    iOS atomic 和 nonatomic 区别
  • 原文地址:https://www.cnblogs.com/liaolei1/p/7249186.html
Copyright © 2011-2022 走看看