HorizontalScrollView setFillViewport - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for HorizontalScrollView setFillViewport method.

This code example shows how to use the following methods:getWidth, postDelayed, setFillViewport, smoothScrollTo
            public void run() { 
                View tabView = widget.getChildAt(position);
                if (tabView != null) {
                    HorizontalScrollView scrollView = (HorizontalScrollView) widget.getParent();
                    assert scrollView != null;
                    scrollView.setFillViewport(true);
 
                    final int scrollPos = tabView.getLeft() - (scrollView.getWidth() - tabView.getWidth()) / 2;
                    scrollView.smoothScrollTo(scrollPos, 0);
                    scrollView.postDelayed(new Runnable() {
                        @Override 
                        public void run() { 
                            onTabPageSelected(position);
                        } 
                    }, 250); 
                } 
            } 
        }, 250); 
    } 
 
5
CodeRank
setFillViewport Method Overview
Indicates this HorizontalScrollView whether it should stretch its content width to fill the viewport or not.
See Code Examples for other Android HorizontalScrollView Methods: