use LinearLayout with vertical orientation instead of TextView
in xml
.
Create TextView
in Java.
each time you get the string from server create new TextView in java and add this into LinearLayout.
Here is example code.
LinearLayout linearLayout = (LinearLayout) findViewById(R.id.linear_layout_id);
TextView tv = new TextView(this);
tv.setText("FirstText");
tv.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT));
linearLayout.addView(tv);
1
solved Android – add lines dynamically to layout