以下のように、文字列を textview に追加し、追加された各文字列にスペースを追加できます。テキストビューの配列は必要ありません。文字列を同じものに追加するだけです。
TextView tv= new TextView(MainActivtiy.this);
tv.setText("");
for(int i=0;i<textArray.length;i++)
{
tv.append(textArray[i]);
tv.append(" ");
}
layout.addView(tv);
編集:
TextView tv= new TextView(MainActivtiy.this);
tv.setText("");
for(int i=0;i<textArray.length;i++)
{
SpannableString ss1= new SpannableString(textArray[i]);
ss1.setSpan(new MyClickableSpan(textArray[i]), 0, ss1.length(),
tv.append(ss1);
tv.append(" ");
}
layout.addView(tv);
MyClickableSpan クラス
class MyClickableSpan extends ClickableSpan{
String clicked;
public MyClickableSpan(String string) {
// TODO Auto-generated constructor stub
super();
clicked =string;
}
public void onClick(View tv) {
Toast.makeText(MainActivity.this,clicked ,Toast.LENGTH_SHORT).show();
//do what is required
}
public void updateDrawState(TextPaint ds) {
ds.setColor(Color.BLUE);//set text color
//ds.setStrokeWidth(15f);
ds.setUnderlineText(true); // set to false to remove underline
}
}