How to scroll to top of long ScrollView layout?

前端 未结 15 868
轻奢々
轻奢々 2020-11-30 18:34

For part of my app, the user is presented with a list of names and is asked to group them as they see fit.

(Note, the ListView code was copied verbatim from the And

15条回答
  •  盖世英雄少女心
    2020-11-30 18:39

    @SuppressWarnings({ "deprecation", "unchecked" })
    public void swipeTopToBottom(AppiumDriver driver) 
                        throws InterruptedException {
           Dimension dimensions = driver.manage().window().getSize();
            Double screenHeightStart = dimensions.getHeight() * 0.30;
            int scrollStart = screenHeightStart.intValue();
            System.out.println("s="+scrollStart);
            Double screenHeightEnd = dimensions.getHeight()*0.90;
            int scrollEnd = screenHeightEnd.intValue();
            driver.swipe(0,scrollStart,0,scrollEnd,2000);
            CommonUtils.threadWait(driver, 3000);
        }
    

提交回复
热议问题