如何判断ScrollView到底部
扫描二维码
随时随地手机看文章
纵向 ScrollView
横向 HorizontalScrollView
判断ScrollView到底部
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
text = (TextView)findViewById(R.id.text);
// text.setText(getResources().getString(R.string.hello_world));
text.setText(R.string.hello_world);
scrollView = (ScrollView)findViewById(R.id.scroll);
scrollView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()){
case MotionEvent.ACTION_MOVE:
//滑动到底部
if(scrollView.getChildAt(0).getMeasuredHeight() <= scrollView.getHeight() + scrollView.getScrollY()){
text.append("aaaaaaaaaaaaaaaaaaaa");
}
break;
}
return false;
}
});
}其他 设置scrollView x y 轴 scrollTo
递增递减 x y 轴 scrollBy





