I have a ScrollView with LinearLayout inside I'm adding TextViews. But I always want the last TextView added to be visible, so I need the ScrollView to scroll to the bottom when a TextView is added. I donโt know why, but when I call scrollto (), scrollby () or fullScroll () after adding a textview, it only scrolls the text to the last.
Do you know the best way to do this?
Thanks a lot!
the code:
I have a button that calls this function:
private void addRound() { // TODO Auto-generated method stub TextView newRound = new TextView(Stopwatch.this); newRound.setText("" + counter + ". - " + timerText()); newRound.setTextSize(20); newRound.setGravity(Gravity.CENTER); linlay.addView(newRound); counter++; }
After calling this function, I call fullScroll ().
addRound(); sv.fullScroll(View.FOCUS_DOWN);
sv ist my ScrollView, linlay is the linear output inside the scroll.
source share