문제

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?

도움이 되었습니까?

해결책

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



                    }
                });
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top