Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在层次结构查看器中有LinearLayout不同的子元素。我怎样才能点击他们的元素?我找不到任何算法来获取这些视图,是否可以使用方法?LinearLayoutsFrameLayoutssolo.clickOnViewgetChild()
LinearLayout
LinearLayouts
FrameLayouts
solo.clickOnView
getChild()
您可以通过 R.id 访问查看:
solo.getView(int id); solo.getView(String id);
您可以按索引访问视图:
solo.getView(Class<T> viewClass, int index);
最后你可以使用任何你想要的android API,包括getChild