简体   繁体   中英

how to implement vertical scroll in scroll view in android

I want to scroll a page using the following code. I am not getting where i am wrong. I am using this piece of code

scroll = (ScrollView)findViewById(R.id.scroll);
    scroll.post(new Runnable() {

        @Override
        public void run() {
            // TODO Auto-generated method stub
            scroll.fullScroll(ScrollView.FOCUS_DOWN);

        }
    });



when i run this code it is not scrolling

Try this

scroll.post(new Runnable() {
                            @Override
                            public void run() {
                                /*
                                 * Scrolling to bottom every time when new
                                 * element is created
                                 */
                                scroll.fullScroll(View.FOCUS_DOWN);
                            }
                        });

I hope this will help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM