Frage

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?

War es hilfreich?

Lösung

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



                    }
                });
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top