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,这个 id 来自另一个活动的光标。
您可以使用 selectChild 函数:
http://www.androidjavadoc.com/m5-rc15/android/app/ExpandableListActivity.html#setSelectedChild(int,%20int,%20boolean)
一个例子:
listView.setSelectedChild(1, 1, true);
View v = myExpandableListView.findViewById(id); v.setSelected(true);