Mar*_*s K 1 android spinner robotium
我在旋转器中向上滚动以选择Robotium测试用例中的第一项时遇到问题.这是我的代码:
int pos = solo.getCurrentSpinners().get(0).getSelectedItemPosition();
solo.pressSpinnerItem(0, 0 - pos);
Run Code Online (Sandbox Code Playgroud)
当我调试时pos是1,但Robotium仍然在索引1上按下微调器,即使我命令它按-1.我究竟做错了什么?
谢谢马库斯
好像他们现在把这些课程拿出来了.刚刚遇到这个问题,但找到了一种方法来正确地做到这一点.
// 0 is the first spinner in the layout
View view1 = solo.getView(Spinner.class, 0);
solo.clickOnView(view1);
solo.scrollToTop(); // I put this in here so that it always keeps the list at start
// select the 10th item in the spinner
solo.clickOnView(solo.getView(TextView.class, 10));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3629 次 |
| 最近记录: |