我有TableLayout,其中包含多个产品.每行包含代码,描述数量,价格,折扣价值,…..取决于用户输入数量,折扣数量和数量.其他一些值也会计算出来.
我的问题是当用户按下数字键非常慢以在EditText中显示.
例如我从键盘按3,经过7或8秒后只显示在特定的editText中.如何缩短此时间线…
这是我的产品图片:
请有人建议为什么会这样?
像这样的代码:
for (int i = initil; i arams(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");
.............................
} });
最佳答案
检查动态tablelayout的此代码:
main.xml:
ottom="20dip"
android:layout_height="fill_parent"
android:background="#C0C0C0">
contact_table = (TableLayout)findViewById(R.id.contact_table);
LayoutInflater inflater = getLayoutInflater();
for(int i = 0; i < contact_count ; i++) {
LinearLayout row = (LinearLayout)inflater.inflate(R.layout.table_row,contact_table,false);
TextView text = (TextView)row.findViewById(R.id.text);
text.setText(list_data.get(i).summary);
contact_table.addView(row);
}
for(int i=0;ietonClickListener(new OnClickListener(){
@Override
public void onClick(View v){
// Todo Auto-generated method stub
row_id=contact_table.indexOfChild(row);
}
});
}
msg_title_text.setonEditorActionListener(new DoneOnEditorActionListener());
相应的动作听众:
class DoneOnEditorActionListener implements OnEditorActionListener {
@Override
public boolean onEditorAction(TextView v,KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
Log.v("*****************************","Clicked");
return true;
}
return false;
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。