hey guys, I am trying to dev my first android app and its going well except for one minor niggle. I have a table which contains a check box and textview per row however the text within the textview goes off the screen to the right. I know this is an issue which can be solved by wrapping the width but I cant work out how to do it in code and not xml.
This is what I have so far.
So can anyone help me work out how to wrap the textview to keep the text on the screen? Thanks.
Btw if this is a noobish question be kind as I am new at this
This is what I have so far.
Code:
for(int count = 0;count < 15; count++)
{
tr = new TableRow(this);
tr.setId(count);
tr.setLayoutParams(new LayoutParams(
LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
tr.setBackgroundResource(R.color.redColor);
check = new CheckBox(this);
check.setPadding(5, 5, 5, 5);
check.setId(count);
text = new TextView(this);
text.setId(count);
text.setText("This is example text which goes off the screen!!!");
text.setPadding(5, 0, 5, 0);
text.setHorizontallyScrolling(false);
//text.setBackgroundResource(R.color.redColor);
tr.addView(check);
tr.addView(text);
table.addView(tr, new TableLayout.LayoutParams(
LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
}
scroll.addView(table);
setContentView(scroll);
Btw if this is a noobish question be kind as I am new at this