My app has edittext and a button. Everytime I click a button a new textview is added to activity. Below is the code:
public void novVnos (View v){
EditText eText = (EditText) findViewById(R.id.editText1);
RelativeLayout mLayout = (RelativeLayout) findViewById(R.id.relativeLayout);
mLayout.addView(createNewTextView(eText.getText().toString()));
}
private TextView createNewTextView (String text){
final LayoutParams lparams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
final TextView textView = new TextView(this);
int counter = 0;
counter += 1;
textView.setLayoutParams(lparams);
textView.setText(counter + ". " + text);
return textView;
}
Now the thing is that whenever I add a new textview using the button, it is automatically placed in the upper left corner of the activity, but I want it somewhere else. I have already (manually) added a new textview to this activity and I want every new textview to be automatically placed UNDER this textview that already exists.