I have a TextView that's inside a LinearLayout that's inside a ScrollView. In my program I can dynamically change what the text is in the TextView. The problem is, I want to be able to specify when the TextView does a return (via \n), but sometimes the text is too long and needs to be scrolled horizontally; that part isn't work. here's some code
Is there something I need to set maybe in the linearlayout that tells the scrollview that the textviews may be too big so it needs to scroll? or what?
Code:
ScrollView scroll = new ScrollView(this);
scroll.setHorizontalScrollBarEnabled(true);
scroll.setHorizontalFadingEdgeEnabled(false);
scroll.setVerticalScrollBarEnabled(true);
scroll.setVerticalFadingEdgeEnabled(false);
scroll.setMeasureAllChildren(true);
LinearLayout layout = new LinearLayout(this);
scroll.addView(layout);
for ( int i=0 ; i<someList.size() ; ++i )
{
TextView tv = new TextView(this);
tv.setHorizontallyScrolling(true);
tv.setText(someList.get(i)); // may need to scroll horizontally
layout.addView(tv);
}
Is there something I need to set maybe in the linearlayout that tells the scrollview that the textviews may be too big so it needs to scroll? or what?