• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps single line textview in a scrollview

Leolicos

Member
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

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?
 
Interesting! I'll look into that, but I'm not looking for my TextView to scroll, I'm looking for the whole Layout to scroll, it scrolls vertically correctly, but it doesn't scroll horizontally...
 
Back
Top Bottom