i want when reach to end ,the right button will change color ,when reach to the begin,the left button will change color ,so ,i want to ask how to detect that the HorizontalScrollView has reached an end.
maxScrollX = horizontalScrollView.getChildAt(0).getMeasuredWidth()-horizontalScrollView.getMeasuredWidth();
if (horizontalScrollView.getScrollX() == 0) {
lImageView.setImageResource(R.drawable.left_green);
} else {
lImageView.setImageResource(R.drawable.left);
}
if (horizontalScrollView.getScrollX() == maxScrollX) {
rImageView.setImageResource(R.drawable.right_green);
} else {
rImageView.setImageResource(R.drawable.right);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With