Pregunta

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?

¿Fue útil?

Solución

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



                    }
                });
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top