首先1,获得ScrollView sc = (ScrollView) findViewById(R.id.scroll);//scroll对象
LinearLayout mlayout = (LinearLayout) findViewById(R.id.mlayout);//scrollView中包含的布局对象
2,定义一个Handler
private final Handler mHandler = new Handler();
3,实现一个线程
private Runnable ScrollRunnable= new Runnable() {
@Override
public void run() {
int off = mlayout.getMeasuredHeight() - sc.getHeight();//判断高度
if (off > 0) {
sc.scrollBy(0, 30);
if (sc.getScrollY() == off) {
Thread.currentThread().interrupt();
} else {
mHandler.postDelayed(this, 1000);
}
}
}
};
4,开始滚动
mHandler.post(ScrollRunnable);
5,暂停滚动
mHandler.removeCallbacks(ScrollRunnable);
ScrollView强制滑到底部
scroll.fullScroll(View.FOCUS_DOWN)
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
机房租用,北京机房租用,IDC机房托管, http://www.e1idc.net