0

在我的应用程序中,我有一个滚动视图,其中列出了 n 个数据。有两个按钮,一个名为 UP,位于滚动视图上方,另一个名为 DOWN,位于滚动视图下方。使用UP and DOWN buttons the list of views can be scrolled.

scroll bar is in top the Up button will be invisible和 当 时,我已经使用该方法scroll bar reaches the bottom the DOWN button will become invisible为此编写了逻辑。getScrollX()

现在我的问题是当数据很少时,例如 3, the scroll bar will not be visible and the layout cannot be scrolled, in such a case both the UP and DOWN buttons need to be in invisible. 如何做到这一点,请给我一个方法?

4

1 回答 1

0

您可以尝试使用 aViewTreeObserver检查View内部的尺寸ScrollView。如果尺寸超过一定的限制(如屏幕大小),ScrollView就会滚动。有关更多详细信息,请参阅此预览 SO 答案。希望有帮助!

于 2013-07-04T10:09:50.647 回答