用户登录
用户注册

分享至

如何在 Android 的移动网站中强制使用带有数字的键盘

  • 作者: 多情的公子
  • 来源: 51数据库
  • 2023-02-09

问题描述

我有一个移动网站,其中包含一些 HTML input 元素,如下所示:

I have a mobile website and it has some HTML input elements in it, like this:

<input type="text" name="txtAccessoryCost" size="6" />

我已将该网站嵌入到 WebView 用于可能的 Android 2.1 消费,因此它也将是一个 Android 应用程序.

I have embedded the site into a WebView for possible Android 2.1 consumption, so that it will also be an Android application.

当这个 HTML input 元素被聚焦时,是否可以获得带有数字的键盘而不是带有字母的默认键盘?

Is it possible to get the keyboard with numbers instead of the default one with letters when this HTML input element is focused?

或者,是否可以为整个应用程序设置它(可能在 Manifest 文件),如果它对于 HTML 元素不可行?

Or, is it possible to set it for the whole application (maybe something in the Manifest file), if it is not feasible for an HTML element?

推荐答案

<input type="number" />
<input type="tel" />

当输入获得焦点时,这两个都会显示数字小键盘.

Both of these present the numeric keypad when the input gains focus.

<input type="搜索"/>显示带有额外搜索按钮的普通键盘

<input type="search" /> shows a normal keyboard with an extra search button

其他一切似乎都调出了标准键盘.

Everything else seems to bring up the standard keyboard.

软件
前端设计
程序设计
Java相关