我正在使用机器人3.1,我想等待视图消失,有什么方法我可以轻松地做到这一点?我目前的方式涉及一个丑陋的忙碌循环与睡眠,没有人开心.
To clarify what I'd like to happen:
waitForView(<View>) //The view appears
//The view is visible for a few seconds
waitForViewNotThere(<View>) //waits until the view has disappeared
Run Code Online (Sandbox Code Playgroud)
出现的视图不包含任何文本或类似文本.任何输入都非常感谢.
这是如何:
final TextView helloWorldText = solo.getText("Hello world!");
solo.waitForCondition(new Condition() {
@Override
public boolean isSatisfied() {
return helloWorldText.getVisibility() == View.INVISIBLE;
}
}, 10000);
Run Code Online (Sandbox Code Playgroud)