简体   繁体   English

android键盘更改phonegap应用程序的布局

[英]android keyboard changes layout of phonegap application

I create a quiz application for android using phonegap framework, The first page of application contains a sign up form, i want to get user information. 我使用phonegap框架为android创建了一个测验应用程序,该应用程序的第一页包含一个注册表单,我想获取用户信息。 my code is 我的代码是

<table class="m">
  <tr>
    <td class="left">Name:</td>
    <td class="right"><input class="t" type="text"/></td>
  </tr>
  <tr>
    <td class="left">Image:</td>
    <td class="right"><input class="t" type="text"/></td>
  </tr>
  <tr>
    <td class="left">Email:</td>
    <td class="right"><input class="t" type="text"/></td>
  </tr>
  <tr>
    <td class="left">Phone:</td>
    <td class="right"><input class="t" type="text"/></td>
    </tr>
</table>

在此处输入图片说明
But when i click on the text field the android keyboard appears on the screen and also it changes the height of my layout, finally the first input field is lifted up and not visible to user 但是,当我单击文本字段时,Android键盘出现在屏幕上,并且它会更改布局的高度,最后,第一个输入字段被抬起,用户看不到
在此处输入图片说明

How can i fix this problem 我该如何解决这个问题

I believe your html codes are too simple, may be it should be a little bit more complicated. 我相信您的html代码太简单了,可能应该更复杂一些。 In my case, I put the table inside the div tag, and set the width and height of the div by JavaScript according to the screen width and height of different phones and browsers. 就我而言,我将表格放在div标签内,然后通过JavaScript根据不同手机和浏览器的屏幕宽度和高度来设置div的宽度和高度。

Also, the font-size are set at a ratio with respect to the screen width so that actual font size seen by the user is approximately the same for different phone. 另外,字体大小设置为相对于屏幕宽度的比例,以使用户看到的实际字体大小对于不同的电话大致相同。

then, use the scrollheight of the div to make sure the user can see the focused input textbox when it is being edited. 然后,使用div的scrollheight来确保用户在编辑焦点输入文本框时可以看到它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM