I am adding textview on runtime and I want textview to be added on the last line or next line if it cannot fit on the last line. I am trying to use RelativeLayout . I am trying to specify params like ALIGN_PARENT_LEFT But this is not working. So, I wanted to ask which layout should I use ?
RelativeLayout ll = (RelativeLayout) findViewById(R.id.categorylayout);
// ll.setGravity(Gravity.LEFT );
RelativeLayout.LayoutParams params = (android.widget.RelativeLayout.LayoutParams) ll.getLayoutParams();
params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
for(int i =0 ; i<tags.size();i++){
TextView tt = new TextView(this);
tt.setText(tags.get(i));
tt.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
tt.setBackgroundColor(Color.RED);
ll.addView(tt );
}