i am using following code. The code should show values of values in a row e.g if the values[] contain {A,B,C,D,E,F} It should show A B C D E F In relative layout. If i don't use LayoutParams pramas then all textViews are added over each other. How can i make them add to the left of each other
for (int i = 0 ; i < values.length ; i++)
{
TextView textView = new TextView(this);
textView.setText(values[i].toString());
textView.setTextColor(Color.BLACK);
textView.setClickable(true);
textView.setId(i);
textView.setBackgroundDrawable(d);
textView.setTextSize(24);
LayoutParams param = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
params.setMargins(5, 50, 0, 0);
if (i>0)
params.addRule(RelativeLayout.RIGHT_OF, i);
textView.setLayoutParams(param);
wordsLayout.addView(textView,params);
}
}
The problem is, when i use wordsLayout.addView(textView,params); Nothing is displayed
RIGHT_OF? or do you want{A,B,C,D,E,F}to display asF E D C B A?