我正在使用EditText
输入数据,但是当显示关闭和打开时,所有输入的数据都被清除,我使用的是 android 版本 2.2.2。
我的代码在这里:
public void placeView() {
mEditText = new EditText(mContext);
mTextView = new TextView(mContext);
mEditText.setSingleLine();
mEditText.onSaveInstanceState();
mEditText.setImeOptions(EditorInfo.IME_ACTION_DONE);
mTextView.setTextColor(mContext.getResources().getColor(R.color.white));
mTextView.setTextColor(Color.WHITE);
mtableRow = new LinearLayout(mContext);
LinearLayout.LayoutParams trLayoutParams = new LinearLayout.LayoutParams(
android.view.ViewGroup.LayoutParams.FILL_PARENT,
android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
mtableRow.setOrientation(LinearLayout.VERTICAL);
mtableRow.setLayoutParams(trLayoutParams);
LayoutParams tvLayoutParams = new LayoutParams(
android.view.ViewGroup.LayoutParams.FILL_PARENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
LayoutParams edtLayoutParams = new LayoutParams(
android.view.ViewGroup.LayoutParams.FILL_PARENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
mEditText.setLayoutParams(edtLayoutParams);
mTextView.setLayoutParams(tvLayoutParams);
mTextView.setTextSize(20);
mtableRow.addView(mTextView);
mtableRow.addView(mEditText);
mtableRow.setPadding(10, 5, 10, 5);
}