I am trying to make a chatting window. There's a TextView wrapped in a ScrollView in the upper side of the screen; and a EditText in the bottom of the screen. I use following code to make the ScrollView scroll automatically when the new message is out of view.
scroll.post(new Runnable(){
@Override
public void run() {
scroll.fullScroll(View.FOCUS_DOWN);
}
});
Something annoying is when the ScrollView scrolls, it steals my focus from the EditText. I can't input my message when 开发者_开发技巧the ScrollView is scrolling. Can anybody give me some light? Thanks a lot : )
I know a workaround. Call requestFocus on the view that should keep the focus.
It would be nice to know if you solved it in a better way.
精彩评论