gpt4 book ai didi

Android:Robotium: Tab 点击只有图标

转载 作者:行者123 更新时间:2023-11-28 20:17:24 26 4
gpt4 key购买 nike

我有选项卡布局。只有图标没有文本。我尝试使用 clickOnImageButton 和 ClickOnButton clickOnImage 以及 pressOnMenuItem(R.drwable.icon) 但没有用。我怎么能用 solo 做到这一点?注意: ImageView 出现在选项卡的顶部。(选项卡在底部)

最佳答案

Tabhost 是邪恶的。幸运的是,我还必须将它们自动化,所以我知道答案。

你要做的是你必须获得标签栏 View (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);

关于Android:Robotium: Tab 点击只有图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13207068/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com