ScrollView当显示超出当前页面时自动移动到最底端
文章出处:http://gundumw100.iteye.com/blog/1162964
?
卷轴视图(ScrollView)是指当拥有很多内容,一屏显示不完时,需要通过滚动来显示视图。比如在做一个阅读器的时候,文章很长,一页显示不完,那么就需要使用卷轴视图来滚动显示下一页。?
?
?
public static void scrollToBottom(final View scroll, final View inner) { Handler mHandler = new Handler(); mHandler.post(new Runnable() { public void run() { if (scroll == null || inner == null) { return; } int offset = inner.getMeasuredHeight() - scroll.getHeight(); if (offset < 0) { offset = 0; } scroll.scrollTo(0, offset); } }); } 1 楼 aswang 2012-04-25 你的文章不错,说到内部机制上了,赞一个! 2 楼 lovehong0306 2012-04-25 aswang 写道你的文章不错,说到内部机制上了,赞一个!