Code example for Layout

Methods: getLineTop, scrollTo

0
    protected boolean scrollPageUp(TextView widget, Spannable buffer) {
        final Layout layout = widget.getLayout();
        final int top = widget.getScrollY() - getInnerHeight(widget);
        int topLine = layout.getLineForVertical(top);
        if (topLine >= 0) {
            Touch.scrollTo(widget, layout, widget.getScrollX(), layout.getLineTop(topLine));
            return true; 
        } 
        return false; 
    } 
 
    /** 
     * Performs a scroll page up action. 
     * Scrolls down by one page. 
     * 
     * @param widget The text view. 
     * @param buffer The text buffer. 
     * @return True if the event was handled. 
     * @hide 
     */ 
    protected boolean scrollPageDown(TextView widget, Spannable buffer) {