I have a TextView
that I\'m dynamically adding text to.
in my main.xml
file I have the properties set to make my max lines 19 and scrollbar
to avoid creating dummy scroolview I did
int top_scr,rec_text_scrollY;
top_scr=(int)rec_text.getTextSize()+rec_text.getHeight();
rec_text_scrollY=rec_text.getLineBounds(rec_text.getLineCount()-1, null)-top_scr;
//repeat scroll here and in rec_text.post.
//If not scroll here text will be "jump up" after new append, and immediately scroll down
//If not scroll in post, than scroll will not be actually processed
if(rec_text_scrollY>0)rec_text.scrollTo(0, rec_text_scrollY);
rec_text.post(new Runnable(){
@Override
public void run() {
if(rec_text_scrollY>0)rec_text.scrollTo(0, rec_text_scrollY);
}
});