Code example for ScrollView

Methods: getBottomoffsetDescendantRectToMyCoordsgetMaxScrollAmount

0
 
    private Rect mTempRect = new Rect();
 
    private int getTopWithinScrollView(View descendant) {
        descendant.getDrawingRect(mTempRect);
        mScrollView.offsetDescendantRectToMyCoords(descendant, mTempRect);
        return mTempRect.top;
    } 
 
    private int getBottomWithinScrollView(View descendant) {
        descendant.getDrawingRect(mTempRect);
        mScrollView.offsetDescendantRectToMyCoords(descendant, mTempRect);
        return mTempRect.bottom;
    } 
 
    @MediumTest 
    public void testPreconditions() { 
        assertTrue("top button should be shorter than max scroll amount",
                mTopButton.getHeight() <
                mScrollView.getMaxScrollAmount());
        assertTrue("bottom button should be further than max scroll amount off screen",
                getTopWithinScrollView(mBottomButton)- mScrollView.getBottom() > mScrollView.getMaxScrollAmount());
    } 
 
    @MediumTest 
    public void testPanTopButtonOffScreenLosesFocus() { 
        sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
Connect your IDE to all the code out there  Get Codota for Java