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.
标题很好地涵盖了我的问题。我如何(例如)获取 ID 不包含“some_prefix”的所有 TextView 元素?我可以获得所有 TextView 元素并对其进行迭代,剔除我不喜欢的元素(我可能会),但我宁愿有一个明确的查询来为我做这件事。
这是低效的,但你可以这样做:
query("android.widget.TextView") - query("android.widget.TextView {id CONTAINS[c] 'some_prefix'}")
第一个query获取所有 TextViews 的集合,然后排除第二个返回的包含“some_prefix”的那些query。
query