软键盘隐藏全屏的WebView的部分 [英] Soft keyboard hides parts of fullscreen webview

查看:276
本文介绍了软键盘隐藏全屏的WebView的部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个原生的Andr​​oid应用程序,是一个网页的包装。它的工作原理pretty很好,但那里的软键盘(Android键盘)出现在web视图,这使得它不可能底部看到你正在写什么,如果你想填写的东西在底部附近的一个问题的web视图。

请在下面看到的图像。在这里,我点击一个textarea这是不可能达到的,而键盘打开:

在code为这种观点是:

 <的RelativeLayout的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    的xmlns:工具=htt​​p://schemas.android.com/tool​​s的android:layout_width =match_parent
    机器人:layout_height =match_parent机器人:paddingLeft =0dp
    机器人:paddingRight =0dp
    机器人:paddingTop =0dp
    机器人:paddingBottom会=0dp工具:上下文=。PetpulseMainActivity>    <的WebView
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =WRAP_CONTENT
        机器人:ID =@ + ID / petpulseWebView/>
< / RelativeLayout的>

我试过切换 RelativeLayout的滚动型和其它方法,我发现,但由于某种原因键盘总是呈现在视图的顶部。

AndroidManifest.xml中:

 <活动
    机器人:名字=。PetpulseMainActivity
    机器人:标签=@字符串/ APP_NAME
    机器人:screenOrientation =肖像>
         [...]
< /活性GT;


解决方案

这是因为所指向的一个已知的错误:

HTTPS://$c$c.google。 COM / p /安卓/问题/细节?ID = 5497

要避免它,删除你的活动全屏主题

更新:

从<一个href=\"http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_FULLSCREEN\"相对=nofollow> FLAG_FULLSCREEN


  

窗口标志:隐藏所有的屏幕装饰(如状态栏)
  显示此窗口。这使得窗口使用
  为自己的整个展示空间 - 在状态​​栏会被隐藏时
  这个标志设置一个应用程序窗口是顶层。全屏
  窗口会忽略的一个SOFT_INPUT_ADJUST_RESIZE价值
  窗口的softInputMode场;该窗口将保持全屏和意志
  不调整。


I am developing a native Android app that is a wrapper for a webpage. It works pretty well, but there is an issue where the soft keyboard (Android keyboard) appears over the bottom of the webview, which makes it impossible to see what you are writing if you are trying to fill out something near the bottom of the webview.

Please see image below. Here I've clicked a textarea that is impossible to reach while the keyboard is open:

The code for this view is:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent" android:paddingLeft="0dp"
    android:paddingRight="0dp"
    android:paddingTop="0dp"
    android:paddingBottom="0dp" tools:context=".PetpulseMainActivity">

    <WebView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/petpulseWebView" />
</RelativeLayout>

I've tried switching the RelativeLayout with ScrollView and other approaches I've found, but for some reason the keyboard is always rendered on top of the view.

AndroidManifest.xml:

<activity
    android:name=".PetpulseMainActivity"
    android:label="@string/app_name"
    android:screenOrientation="portrait">
         [...]
</activity>

解决方案

It's a known bug as refered in :

https://code.google.com/p/android/issues/detail?id=5497

To avoid it, remove the FullScreen theme of your activity

Update:

From FLAG_FULLSCREEN

Window flag: hide all screen decorations (such as the status bar) while this window is displayed. This allows the window to use the entire display space for itself -- the status bar will be hidden when an app window with this flag set is on the top layer. A fullscreen window will ignore a value of SOFT_INPUT_ADJUST_RESIZE for the window's softInputMode field; the window will stay fullscreen and will not resize.

这篇关于软键盘隐藏全屏的WebView的部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆