如何知道用户是否确实需要使用滚动?

时间:2012-12-08 11:11:21

标签: android android-scrollbar

所以我有这个Android应用程序,其中菜单有很多按钮。我已将滚动设置为屏幕较小的手机,他们需要向下滚动才能看到所有按钮,但对于大屏幕手机,无需滚动,因为所有按钮都可见。

我需要提醒需要使用对话框或其他内容向下滚动的用户,但需要为不需要滚动的人做任何事情。

这甚至可能吗?

1 个答案:

答案 0 :(得分:-1)

scrollView.getViewTreeObserver().addOnGlobalLayoutListener(
                new ViewTreeObserver.OnGlobalLayoutListener() {
                    @Override
                    public void onGlobalLayout() {  
                    int scrollRange = scrollView
                                .computeVerticalScrollRange();
                    if(scrollRange>screenHeight){
                     //user need to scroll
                     }



                    }
                });
相关问题