我希望当到达结束时,右键会改变颜色,当到达开始时,左键会改变颜色,所以,我想问一下如何检测HorizontalScrollView已经到了结尾.
解决方法
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); }