本人现在有个需求:
我有一个EditText,当我这个EditText里text不为空的时候,我需要添加一个EditText,然后再给这个EditText里传值,然后判断它是否为null,为null继续添加。
请教各位大神怎么做,求指点下思路
public void initView() {
setContentView(R.layout.add);
lin = (LinearLayout) findViewById(R.id.linear);
e1 = (EditText) findViewById(R.id.e1);
tex = e1.getText().toString();
addview();
}
private void addview() {
if (tex.length() != 0) {
EditText e2 = new EditText(getContext());
lin.addView(e2);
}
}