Question

So I have this android app, where the menu has a lot of buttons. I have put scroll so for phones with smaller screen, they need to scroll down to see all the buttons, but for phones with big screen, there is no need to scroll as all the buttons will be visible.

I need to alert the users who need to use scroll down using a dialog or something, but need do anything for those who need not scroll.

Is this even possible?

Was it helpful?

Solution

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



                    }
                });
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top