【发布时间】:2011-10-07 04:46:25
【问题描述】:
我有 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");
.............................
} });
【问题讨论】:
-
检查减少表格布局中的行,......
-
你在真机上查过吗..?
-
@Viv 当前首页包含 10 条记录。我不能减少更多,因为有些客户有超过 400 条记录。这样。如果我们在循环的外侧标出,是否可以在外面获取行值? (我想不是)。如果我们在外面声明就可以了。
-
@LalitPoptani 我也检查了真实设备。这也是同样的问题。由于问题监听器方法在循环内。第一页(分页)包含10条记录。
标签: android soft-keyboard