Code to scroll the ScrollView to bottom of the Screen at runtime,Android

======>  Here in my LegalPlex Version-2 project, i have a requirement of "Client Details screen in small devices(because in large devices this layout is not used) ,like it will showed initially only bottom elements of screen.For that we need to scroll the ScrollView(Which contains all the elements of that Layout) initially to the bottom of the screen.

For doing that i used below code,and put that code in onStart() method.
If you want to place in some other place,it is also possible.i just used this based on my requirement only.


@Override
    public void onStart() {
        super.onStart();
        
        clientDetailsScreenScrollView=((ScrollView) findViewById(R.id.clientDetailsScreenScrollView));
        clientDetailsScreenScrollView.post(new Runnable() {

            @Override
            public void run() {
                clientDetailsScreenScrollView.fullScroll(ScrollView.FOCUS_DOWN);
            }
        });
    }

Comments

Popular posts from this blog

Custom Dialog with no title and full screen in Android

Best working code to set Date limits on Date Picker Dialog,in Android

code to display .pdf,.text,.DOC,.DOCX,.doc extension files exists in SDCard