I am new here, sorry if I am not so good in the explainаtion. ;) I want to add and remove a dynamic EditText fields?
private final View.OnClickListener addRowListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
//HERE????
};
Than开发者_运维知识库k you in advance
If you want to create the views
@Override
public void onClick(View view) {
TextView text = new TextView(yourActivity.this);
};
If you have the views
TextView TV1,TV2;
@Override
public void onClick(View view) {
if(TV1.getVisibility()==View.GONE)
TV1.setVisibility(View.VISIBLE);
else
TV1.setVisibility(View.GONE);
};
you have to add and remove your EditText from the Layout dynamically.
LinearLayout layout=(LinearLayout)findViewById(R.id.layout);
To create New
EditText text=new EditText(this); layout.addView(text);
to Remove
layout.removeView(text);
精彩评论