当用户点击HTML页面中的文本输入字段时,有没有办法指定显示哪种软键盘布局(我只需要数字)?
我可以更改HTML页面和Javacode(我有一个嵌入WebView的活动).但是,如果我更改HTML代码,它必须不会影响其他平台(另一个浏览器/设备仍然应该正确解释输入字段并显示软键盘,而不一定只有数字键盘)
我有TableLayout,其中包含多个产品.每行包含代码,描述数量,价格,折扣价值,.....取决于用户输入数量,折扣价值,折扣数量和其他一些值也会计算.
当用户点击editText软键盘时,这个也可以,工作正常
我的问题是当用户按下数字键非常慢以在EditText中显示.
例如我从键盘按3,经过7或8秒后只显示在特定的editText中.如何缩短此时间线...
这是我的产品图片:

请有人建议为什么会这样?
像这样的代码:
for (int i = initil; i <end; i++) {
.............
............
final EditText txtQty = new EditText(this);
txtQty.setHeight(1);
txtQty.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, 42));
txtQty.setInputType(InputType.TYPE_CLASS_PHONE);
txtQty.setImeOptions(EditorInfo.IME_ACTION_DONE);
txtQty.setImeOptions(EditorInfo.IME_ACTION_NEXT);
txtQty.setSelectAllOnFocus(true);
txtQty.setTextSize(9);
txtQty.setHint("0.0");
// txtQty.setOnEditorActionListener(new DoneOnEditorActionListener());
// txtQty.setHighlightColor(R.color.green);
tr.addView(txtQty);
InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
mgr.showSoftInput(txtQty, InputMethodManager.SHOW_IMPLICIT);
mgr.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT,InputMethodManager.HIDE_IMPLICIT_ONLY);
((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(txtQty.getWindowToken(), 0);
txtQty.setOnEditorActionListener( new OnEditorActionListener() {
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
Log.i("KeyBoard" ,"Inside the Edit Text");
.............................
} });
Run Code Online (Sandbox Code Playgroud) 我有一个简单布局的移动AIR应用程序:
<s:layout><s:VerticalLayout /></s:layout>
<s:TextArea width="100%" height="100%" />
<HGroup width="100%" >
<s:Button label="button" />
<s:Button label="button" />
<s:Button label="button" />
</HGroup>
Run Code Online (Sandbox Code Playgroud)
通过在主应用程序中设置resizeForSoftKeyboard ="true",应用程序设置为在软键盘打开时调整大小.textArea使用默认的Flex 4.6外观.
我的问题是,如果用户通过在我的texArea中键入文本来打开键盘,他将无法单击TextArea下面的按钮,因为一旦他尝试单击一个按钮,软键盘就会降低(因为它将焦点放在一边) TextArea?)并立即再次打开(因为mouseDown位置现在位于TextArea之上?).
如何防止软键盘关闭,以便用户可以单击TextArea和键盘之间的按钮?
谢谢
我定制了软键盘.但键盘键(1,2,3,4,5,6,7,8,9,0,和OK)看起来很模糊.删除键很好,但其他键看起来很模糊.
这是我的键盘.

这是我的自定义键盘xml文件
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="0px"
android:keyHeight="10%p"
android:keyWidth="24%p"
android:verticalGap="0px" >
<Row>
<Key
android:codes="49"
android:keyEdgeFlags="left"
android:keyLabel="1" />
<Key
android:codes="50"
android:keyLabel="2" />
<Key
android:codes="51"
android:keyLabel="3" />
<Key
android:codes="-3"
android:keyEdgeFlags="right"
android:keyLabel="OK"
android:keyWidth="28%p" />
</Row>
<Row>
<Key
android:codes="52"
android:keyEdgeFlags="left"
android:keyLabel="4" />
<Key
android:codes="53"
android:keyLabel="5" />
<Key
android:codes="54"
android:keyLabel="6" />
<Key
android:codes="-5"
android:isRepeatable="true"
android:keyEdgeFlags="right"
android:keyIcon="@drawable/sym_keyboard_delete"
android:keyWidth="28%p" />
</Row>
<Row>
<Key
android:codes="55"
android:keyEdgeFlags="left"
android:keyLabel="7" />
<Key
android:codes="56"
android:keyLabel="8" />
<Key
android:codes="57"
android:keyLabel="9" />
<Key
android:codes="48"
android:keyLabel="0"
android:keyWidth="14%p" />
<Key
android:codes="46"
android:keyEdgeFlags="right"
android:keyLabel="."
android:keyWidth="14%p" />
</Row>
Run Code Online (Sandbox Code Playgroud)
我注意到某些Windows Phone 8.1屏幕(如Microsoft帐户登录向导)在软键盘下方有"上一页"或"下一页"等按钮.因此,您可以在输入字段中输入任何内容,然后点击按钮进入下一个屏幕,而无需先关闭键盘.这不仅仅是一个标准的应用栏.但是,我无法找到哪些API执行此操作,无法找到解释如何在线执行此操作的任何内容.
有没有人发现如何做到这一点?或者第三方应用程序是不可能的?
当自动聚焦场时,如何使软键盘提供自举模式? 这听起来很容易,但我还是无法做到.
焦点部分可以工作,但不是键盘.
我试图保存用户点击.
我可以利用'shown.bs.modal'并设置焦点,但软键盘不会自动显示.用户仍然需要重新占用该字段.如何强制软键盘出现.
我正在玩的代码(非常):
this.$container.on('shown.bs.modal', function () {
console.log('shown.bs.modal');
setTimeout(function () {
var $ctrl = $(jqselector);
$ctrl.addClass('active').focus();
}, 500);
});
this.$container.modal({
backdrop: (this.config.showModal ? 'static' : true)
})
.on('hidden.bs.modal', function () {
$(this).remove();
});
Run Code Online (Sandbox Code Playgroud)
编辑:稍微查看一下bootstrap代码后,看起来广告在所有处理后都会关注模态控件.我假设这样的事情正在发生,这就是为什么我添加了setTimeout,但即使有很大的延迟,也没有运气.我将在本周末更仔细地研究一下bootsrap代码
赏金编辑:Bootstrap代码:
Modal.prototype.show = function (_relatedTarget) {
var that = this
var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
this.$element.trigger(e)
if (this.isShown || e.isDefaultPrevented()) return
this.isShown = true
this.checkScrollbar()
this.$body.addClass('modal-open')
this.setScrollbar()
this.escape()
this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
this.backdrop(function () {
var transition = …Run Code Online (Sandbox Code Playgroud) 我的键盘有问题。当它消失时,它所占据的空间将保持空白,并且布局的其余部分不会调整
正常屏幕:

带键盘:

键盘已关闭:

我之前从未见过,所以我什至不知道从哪里开始寻找。这发生在4.2.2和5.1
另一个重要的信息是这是一个自定义的LinearLayout,其中包含所有内容。也许与此有关。如有必要,我可以上传任何代码。
这是主布局文件外壳。
<com.edgetechlabs.app_v2.MasterLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Menu (Drawer)-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:visibility="visible"
android:layout_height="match_parent"
android:orientation="vertical" >
<ScrollView
android:id="@+id/activity_main_menu_listview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/drawer_background"
android:cacheColorHint="#00000000" >
</ScrollView>
</LinearLayout>
<!-- Fragment Holder -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- This is where fragment will show up -->
<FrameLayout
android:id="@+id/fragment_master"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
这是我的清单文件
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MasterActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Run Code Online (Sandbox Code Playgroud) 我有以下代码:
if(mSearchView != null){
mSearchView.setIconifiedByDefault(false);
mSearchView.setIconified(false);
mSearchView.setOnQueryTextListener(this);
int searchPlateId = mSearchView.getContext().getResources()
.getIdentifier("android:id/search_plate", null, null);
View searchPlateView = mSearchView.findViewById(searchPlateId);
if (searchPlateView != null) {
searchPlateView.setBackgroundColor(getResources().getColor(R.color.white));
}
}
Run Code Online (Sandbox Code Playgroud)
问题是,当我在serachview上设置setIconified(false)时,键盘会弹出,我不希望这种情况发生.有可能以某种方式阻止这种情况吗?PS:我在清单中有这个:
android:windowSoftInputMode="adjustNothing|stateHidden"
Run Code Online (Sandbox Code Playgroud)
也可以在onCreate中以编程方式进行,但没有运气
keyboard android soft-keyboard android-softkeyboard searchview
我在活动底部附近有一个EditText.当我第一次单击时出现键盘然后布局向上移动以使EditText可见以在其中写入并查看您的数字.
当我关闭键盘(使用DONE按钮)并再次单击EditText时,布局不会移动,并且键盘将完全覆盖EditText.
我尝试了ScrollView和AdjustResize以及AdjustPan,但没有任何改变.
<com.mypackage.widget.CEditText
android:id="@+id/myETid"
android:layout_width="@dimen/edittext_medium_width"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@drawable/background_edittext"
android:gravity="center_horizontal"
android:inputType="number"
android:maxLength="14"
android:padding="@dimen/activity_smargin"
android:singleLine="true"
android:textColor="@android:color/black"
android:textSize="@dimen/font_midcommon_size"
app:typeface="@string/commonFontRegular" />
Run Code Online (Sandbox Code Playgroud)
这是我的自定义EditText(它只是扩展Standard EditText来管理TypeFace)
<activity
android:name=".gui.activity.MyActivity"
android:label="@string/activity_name"
android:windowSoftInputMode="stateHidden|adjustPan"
android:screenOrientation="landscape" >
</activity>
Run Code Online (Sandbox Code Playgroud)
这是AndroidManifest的Activity条目.
有任何想法吗?
keyboard android soft-keyboard android-layout android-edittext
我正在制作聊天服务,我想很好地支持移动设备。
在下面的屏幕截图中,有一个输入字段。它允许输入文本,并避免诸如“如果文本字段未聚焦输入什么都不做”之类的问题,它会在单击外部时自动聚焦——这确实改善了台式计算机的体验。但是,在带有软键盘的设备上,这会导致屏幕键盘出现在分散注意力的移动设备上。
考虑到单击任何地方聚焦文本输入,是否有可能使屏幕键盘仅在按下文本字段时出现?或者,以某种方式检测启用了软件键盘的设备并为它们禁用此功能。最好不要明确尝试检测移动设备、触摸屏或其他任何存在的带有硬件键盘的触摸屏设备。
这个问题我能够在 Android 上的 Google Chrome 和 Opera Mobile 中重现,显然它发生在 iPhone 上,尽管我没有设备可以测试它。
这是一个相当简单的问题示例。如果您触摸粉红色矩形,则会导致出现触摸键盘,这是我不想要的。
<input type=text id=f>
<div style="background: pink; height: 200px; width: 200px" onclick="f.focus()">Run Code Online (Sandbox Code Playgroud)
soft-keyboard ×10
android ×6
keyboard ×3
javascript ×2
mobile ×2
air ×1
apache-flex ×1
blurry ×1
c# ×1
focus ×1
html ×1
html-input ×1
searchview ×1