1

I have tab layout.That has only icons not text.I tried with clickOnImageButton and ClickOnButton clickOnImage and also pressOnMenuItem(R.drwable.icon)but not worked.How can i do this with solo? Note: Image View present at the top of the tab.(tab is at bottom)

4

3 回答 3

7

Tabhosts是邪恶的。幸运的是,我还不得不将它们自动化,所以知道答案。

你要做的是你必须获得标签栏视图(android.R.id.tabs),然后将其转换为 Tabhost 或 ViewGroup 然后你可以通过 .getChildAt(x) 获取每个标签,其中 x 是索引的选项卡。

ViewGroup tabs = (ViewGroup) solo.getView(android.R.id.tabs);
View viewYouWantToDoStuffWith = tabs.getChildAt(x); //change x to the index you want.

在你的情况下,你会想要类似的东西:

solo.clickOnView(viewYouWantToDoStuffWith);
于 2012-11-05T11:42:03.207 回答
2

you can use method solo.clickOnView(solo.getView(resourceId));
where resourceId could be something like R.id.id_Of_Button.

于 2012-11-03T07:55:18.340 回答
0

请参阅此链接,因为他们正在使用图像+文本。所以删除作为图像制作的文本,你必须这样做。

http://www.androidhive.info/2011/08/android-tab-layout-tutorial/

这仅适用于您可以使用图像设置并作为自定义选项卡的文本。

http://www.androidpeople.com/android-tabhost-tutorial-part-1

希望它对你有用。

于 2012-11-03T07:45:33.733 回答