1

我正在使用 Android 上的 PhoneGap/Mobile jQuery 制作应用程序。我正在使用 phonegap 2.3.0 版

我可以编辑表单中的某些字段,但是当我开始填写其他字段时,它不会显示字段内的文本。

我看到很多人遇到这个问题,但还没有人找到解决方案

以下是人们遇到相同问题的一些链接

http://community.phonegap.com/nitobi/topics/phonegap_2_0_0_2_1_0_and_android_4_1_inputtext_text_not_taking_input_after_some_seconds http://community.phonegap.com/nitobi/topics/android_version_4_1_1

我对android没有太多经验,我正在使用带有phonegap的HTML5

我使用他们的网站http://docs.phonegap.com/en/2.3.0/guide_getting-started_android_index.md.html#Getting%20Started%20with%20Android上的教程来设置应用程序

它创建了应用程序,我将应用程序命名为 phonetest,并且我的主 java 文件包含此代码。

/*
       Licensed to the Apache Software Foundation (ASF) under one
       or more contributor license agreements.  See the NOTICE file
       distributed with this work for additional information
       regarding copyright ownership.  The ASF licenses this file
       to you under the Apache License, Version 2.0 (the
       "License"); you may not use this file except in compliance
       with the License.  You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

       Unless required by applicable law or agreed to in writing,
       software distributed under the License is distributed on an
       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
       KIND, either express or implied.  See the License for the
       specific language governing permissions and limitations
       under the License.
 */

package com.inam.phonetest;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.util.Log;

import org.apache.cordova.*;


    public class phonetest extends DroidGap
    {
        @Override
        public void onCreate(Bundle savedInstanceState)
        {
            // testing asdfsd
            try
            {
                    String pName = this.getClass().getPackage().getName();
                    Log.w("myApp", "no network"+"/data/data/"+pName+"/databases/");
                    this.copy("cps.db","/data/data/"+pName+"/databases/");
                    //this.copy("0000000000000001.db","/data/data/"+pName+"/databases/file__0/");
            }
            catch (IOException e)
            {

                e.printStackTrace();
            }

            File database=getApplicationContext().getDatabasePath("cps.db");

            if (!database.exists()) {
                // Database does not exist so copy it from assets here
                Log.w("Database", "Not Found");
            } else {
                Log.w("Database", "Found");
            }


            super.onCreate(savedInstanceState);
              ////////////
            setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
            super.loadUrl("file:///android_asset/www/index.html");
        }

        void copy(String file, String folder) throws IOException 
        {

         File CheckDirectory;
         CheckDirectory = new File(folder);
         if (!CheckDirectory.exists())
         { 
          CheckDirectory.mkdir();
         }

            InputStream in = getApplicationContext().getAssets().open(file);
            OutputStream out = new FileOutputStream(folder+file);

            // Transfer bytes from in to out
            byte[] buf = new byte[1024];
            int len; while ((len = in.read(buf)) > 0) out.write(buf, 0, len);
            in.close(); out.close();

        }
    }

我的 HTML 文件有这个脚本

<table><tr>
<td><input  name="last_name" id="last_name" type="text" class="mytextfield"  style="height:35px; width:250px;" tabindex=""  value="" /></td>
      <td  ><font color="red">*</font>Home Phone Number </td>
      <td  ><input  name="phone_num" id="phone_num"  value=""  tabindex="" type="text" pattern="[0-9]*" maxlength="10" /></td>
    </tr>
</table>
4

1 回答 1

0

我在输入字段中使用maxlengthandmax并且该字段并没有限制我输入超过 maxlength 和 max 的字符,这以某种方式破坏了某些规则,之后它停止在字段中显示单词。

于 2013-03-20T11:40:52.597 回答