2
我有自定义groupViews,它们在展开和折叠时需要更改状态。 如果同一组视图被展开,它将在两个状态之间切换。自定义视图不会使用ExpandableListView上的OnGroupClickListener更新
我遇到的问题是展开方法似乎是拉起一些缓存版本的意见,因为我的更新在调用expandGroup后不可见。
如果我的监听器在不调用expandGroup的情况下返回true(处理整个事件本身),则会发生更新。所以expandGroup发生了一些事情,只允许绘制缓存视图。 我试过无效()几乎一切。我试着在列表视图上触发数据更新事件。我已经尝试了所有这其他的东西,以及:
expandableList.setGroupIndicator(null);
expandableList.setAlwaysDrawnWithCacheEnabled(false);
expandableList.setWillNotCacheDrawing(true);
expandableList.setItemsCanFocus(false);
任何那些没有运气:(
这里是我的onClick代码:
expandableList.setOnGroupClickListener(new OnGroupClickListener() {
public boolean onGroupClick(ExpandableListView parent, View v,
int groupPosition, long id) {
MusicTrackRow mt = (MusicTrackRow) v;
if (mt.isPlaying == true) {
mt.setPaused();
} else {
mt.setPlaying();
}
mt.invalidate();
parent.invalidate();
trackAdapter.notifyDataSetInvalidated();
//need to call expandGroup if the listener returns true.. if returning false expandGroup is //returned automatically
expandableList.expandGroup(groupPosition); //no view refresh
return true;